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
21 #include "cmd-magiceat.h"
23 #include "floor-events.h"
24 #include "floor-save.h"
26 #include "objectkind.h"
27 #include "object-boost.h"
28 #include "object-flavor.h"
29 #include "object-hook.h"
31 #include "monsterrace-hook.h"
43 #include "cmd-spell.h"
46 #include "spells-object.h"
47 #include "spells-status.h"
48 #include "realm-hex.h"
49 #include "dungeon-file.h"
52 #include "player-status.h"
53 #include "player-effects.h"
54 #include "player-class.h"
55 #include "player-personality.h"
58 #include "view-mainwindow.h"
59 #include "monsterrace.h"
66 building_type building[MAX_BLDG];
68 MONRACE_IDX battle_mon[4];
74 bool reinit_wilderness = FALSE;
75 MONSTER_IDX today_mon;
78 * @brief 闘技場のモンスターID及び報酬アイテムテーブル
80 const arena_type arena_info[MAX_ARENA_MONS + 2] =
82 { MON_NOBORTA, TV_AMULET, SV_AMULET_ADORNMENT },
83 { MON_MORI_TROLL, TV_FOOD, SV_FOOD_PINT_OF_WINE },
84 { MON_IMP, TV_POTION, SV_POTION_SPEED },
85 { MON_LION_HEART, 0, 0 },
86 { MON_MASTER_YEEK, TV_POTION, SV_POTION_CURING },
87 { MON_SABRE_TIGER, TV_WAND, SV_WAND_STONE_TO_MUD },
88 { MON_LIZARD_KING, TV_WAND, SV_WAND_TELEPORT_AWAY },
89 { MON_WYVERN, TV_POTION, SV_POTION_HEALING },
90 { MON_ARCH_VILE, TV_POTION, SV_POTION_RESISTANCE },
91 { MON_ELF_LORD , TV_POTION, SV_POTION_ENLIGHTENMENT },
92 { MON_GHOUL_KING, TV_FOOD, SV_FOOD_RESTORING },
93 { MON_COLBRAN, TV_RING, SV_RING_ELEC },
94 { MON_BICLOPS, TV_WAND, SV_WAND_ACID_BALL },
95 { MON_M_MINDCRAFTER, TV_POTION, SV_POTION_SELF_KNOWLEDGE },
96 { MON_GROO, TV_SCROLL, SV_SCROLL_ACQUIREMENT },
97 { MON_RAAL, TV_SCROLL, SV_SCROLL_STAR_DESTRUCTION },
98 { MON_DREADMASTER, TV_WAND, SV_WAND_HYPODYNAMIA },
99 { MON_ULTRA_PALADIN, TV_STAFF, SV_STAFF_DISPEL_EVIL },
100 { MON_BARNEY, TV_RING, SV_RING_RES_CHAOS },
101 { MON_TROLL_KING, TV_SCROLL, SV_SCROLL_MASS_GENOCIDE },
102 { MON_BARON_HELL, TV_POTION, SV_POTION_AUGMENTATION },
103 { MON_F_ANGEL, TV_SCROLL, SV_SCROLL_RUNE_OF_PROTECTION },
104 { MON_G_C_DRAKE, TV_WAND, SV_WAND_DRAGON_FIRE },
105 { MON_IRON_LICH, TV_STAFF, SV_STAFF_DESTRUCTION },
106 { MON_DROLEM, TV_POTION, SV_POTION_STAR_HEALING },
107 { MON_G_TITAN, TV_WAND, SV_WAND_GENOCIDE },
108 { MON_G_BALROG, TV_POTION, SV_POTION_EXPERIENCE },
109 { MON_ELDER_VAMPIRE, TV_RING, SV_RING_SUSTAIN },
110 { MON_NIGHTWALKER, TV_WAND, SV_WAND_STRIKING },
111 { MON_S_TYRANNO, TV_SCROLL, SV_SCROLL_STAR_ACQUIREMENT },
112 { MON_G_MASTER_MYS, TV_ROD, SV_ROD_IDENTIFY },
113 { MON_LORD_CHAOS, TV_POTION, SV_POTION_LIFE },
114 { MON_SHADOWLORD, TV_POTION, SV_POTION_STAR_ENLIGHTENMENT },
115 { MON_ULT_BEHOLDER, TV_AMULET, SV_AMULET_REFLECTION },
116 { MON_JABBERWOCK, TV_ROD, SV_ROD_HEALING },
117 { MON_LOCKE_CLONE, TV_WAND, SV_WAND_DISINTEGRATE },
118 { MON_WYRM_SPACE, TV_ROD, SV_ROD_RESTORATION },
119 { MON_SHAMBLER, TV_SCROLL, SV_SCROLL_STAR_ACQUIREMENT },
120 { MON_BLACK_REAVER, TV_RING, SV_RING_LORDLY },
121 { MON_FENGHUANG, TV_STAFF, SV_STAFF_THE_MAGI },
122 { MON_WYRM_POWER, TV_SCROLL, SV_SCROLL_ARTIFACT },
123 { 0, 0, 0 }, /* Victory prizing */
124 { MON_HAGURE, TV_SCROLL, SV_SCROLL_ARTIFACT },
128 * @brief 施設毎に設定された種族、職業、魔法領域フラグがプレイヤーと一致するかを判定する。
129 * @details 各種ギルドや寺院など、特定の職業ならば優遇措置を得られる施設、
130 * あるいは食堂など特定の種族では利用できない施設の判定処理を行う。
131 * @param bldg 施設構造体の参照ポインタ
132 * @return 種族、職業、魔法領域のいずれかが一致しているかの是非。
134 static bool is_owner(building_type *bldg)
136 if (bldg->member_class[p_ptr->pclass] == BUILDING_OWNER)
141 if (bldg->member_race[p_ptr->prace] == BUILDING_OWNER)
146 if ((is_magic(p_ptr->realm1) && (bldg->member_realm[p_ptr->realm1] == BUILDING_OWNER)) ||
147 (is_magic(p_ptr->realm2) && (bldg->member_realm[p_ptr->realm2] == BUILDING_OWNER)))
156 * @brief 施設毎に設定された種族、職業、魔法領域フラグがプレイヤーと一致するかを判定する。
158 * @details 各種ギルドや寺院など、特定の職業ならば優遇措置を得られる施設、
159 * あるいは食堂など特定の種族では利用できない施設の判定処理を行う。
160 * @param bldg 施設構造体の参照ポインタ
161 * @return 種族、職業、魔法領域のいずれかが一致しているかの是非。
162 * @todo is_owner()との実質的な多重実装なので、リファクタリングを行うべきである。
164 static bool is_member(building_type *bldg)
166 if (bldg->member_class[p_ptr->pclass])
171 if (bldg->member_race[p_ptr->prace])
176 if ((is_magic(p_ptr->realm1) && bldg->member_realm[p_ptr->realm1]) ||
177 (is_magic(p_ptr->realm2) && bldg->member_realm[p_ptr->realm2]))
183 if (p_ptr->pclass == CLASS_SORCERER)
187 for (i = 0; i < MAX_MAGIC; i++)
189 if (bldg->member_realm[i+1]) OK = TRUE;
197 * @brief コンソールに表示された施設に関する情報を消去する / Clear the building information
198 * @details 消去は行毎にヌル文字列で行われる。
199 * @param min_row 開始行番号
200 * @param max_row 末尾行番号
203 void clear_bldg(int min_row, int max_row)
207 for (i = min_row; i <= max_row; i++)
215 static void building_prt_gold(void)
218 prt(_("手持ちのお金: ", "Gold Remaining: "), 23,53);
219 sprintf(tmp_str, "%9ld", (long)p_ptr->au);
220 prt(tmp_str, 23, 68);
224 * @brief 施設のサービス一覧を表示する / Display a building.
225 * @param bldg 施設構造体の参照ポインタ
228 static void show_building(building_type* bldg)
236 sprintf(tmp_str, "%s (%s) %35s", bldg->owner_name, bldg->owner_race, bldg->name);
240 for (i = 0; i < 8; i++)
242 if (bldg->letters[i])
244 if (bldg->action_restr[i] == 0)
246 if ((is_owner(bldg) && (bldg->member_costs[i] == 0)) ||
247 (!is_owner(bldg) && (bldg->other_costs[i] == 0)))
249 action_color = TERM_WHITE;
252 else if (is_owner(bldg))
254 action_color = TERM_YELLOW;
255 sprintf(buff, _("($%ld)", "(%ldgp)"), (long int)bldg->member_costs[i]);
259 action_color = TERM_YELLOW;
260 sprintf(buff, _("($%ld)", "(%ldgp)"), (long int)bldg->other_costs[i]); }
262 else if (bldg->action_restr[i] == 1)
264 if (!is_member(bldg))
266 action_color = TERM_L_DARK;
267 strcpy(buff, _("(閉店)", "(closed)"));
269 else if ((is_owner(bldg) && (bldg->member_costs[i] == 0)) ||
270 (is_member(bldg) && (bldg->other_costs[i] == 0)))
272 action_color = TERM_WHITE;
275 else if (is_owner(bldg))
277 action_color = TERM_YELLOW;
278 sprintf(buff, _("($%ld)", "(%ldgp)"), (long int)bldg->member_costs[i]);
282 action_color = TERM_YELLOW;
283 sprintf(buff, _("($%ld)", "(%ldgp)"), (long int)bldg->other_costs[i]);
290 action_color = TERM_L_DARK;
291 strcpy(buff, _("(閉店)", "(closed)"));
293 else if (bldg->member_costs[i] != 0)
295 action_color = TERM_YELLOW;
296 sprintf(buff, _("($%ld)", "(%ldgp)"), (long int)bldg->member_costs[i]);
300 action_color = TERM_WHITE;
305 sprintf(tmp_str," %c) %s %s", bldg->letters[i], bldg->act_names[i], buff);
306 c_put_str(action_color, tmp_str, 19+(i/2), 35*(i%2));
309 prt(_(" ESC) 建物を出る", " ESC) Exit building"), 23, 0);
313 * @brief 闘技場に入るコマンドの処理 / arena commands
314 * @param cmd 闘技場処理のID
317 static void arena_comm(int cmd)
326 if (p_ptr->arena_number == MAX_ARENA_MONS)
329 prt(_("アリーナの優勝者!", " Arena Victor!"), 5, 0);
330 prt(_("おめでとう!あなたは全ての敵を倒しました。", "Congratulations! You have defeated all before you."), 7, 0);
331 prt(_("賞金として $1,000,000 が与えられます。", "For that, receive the prize: 1,000,000 gold pieces"), 8, 0);
335 p_ptr->au += 1000000L;
336 msg_print(_("スペースキーで続行", "Press the space bar to continue"));
338 p_ptr->arena_number++;
340 else if (p_ptr->arena_number > MAX_ARENA_MONS)
342 if (p_ptr->arena_number < MAX_ARENA_MONS+2)
344 msg_print(_("君のために最強の挑戦者を用意しておいた。", "The strongest challenger is waiting for you."));
346 if (get_check(_("挑戦するかね?", "Do you fight? ")))
348 msg_print(_("死ぬがよい。", "Die, maggots."));
351 p_ptr->exit_bldg = FALSE;
352 reset_tim_flags(p_ptr);
354 /* Save the surface floor as saved floor */
355 prepare_change_floor_mode(CFM_SAVE_FLOORS);
357 p_ptr->inside_arena = TRUE;
358 p_ptr->leaving = TRUE;
359 p_ptr->leave_bldg = TRUE;
363 msg_print(_("残念だ。", "We are disappointed."));
368 msg_print(_("あなたはアリーナに入り、しばらくの間栄光にひたった。",
369 "You enter the arena briefly and bask in your glory."));
373 else if (p_ptr->riding && (p_ptr->pclass != CLASS_BEASTMASTER) && (p_ptr->pclass != CLASS_CAVALRY))
375 msg_print(_("ペットに乗ったままではアリーナへ入れさせてもらえなかった。",
376 "You don't have permission to enter with pet."));
381 p_ptr->exit_bldg = FALSE;
382 reset_tim_flags(p_ptr);
384 /* Save the surface floor as saved floor */
385 prepare_change_floor_mode(CFM_SAVE_FLOORS);
387 p_ptr->inside_arena = TRUE;
388 p_ptr->leaving = TRUE;
389 p_ptr->leave_bldg = TRUE;
393 if (p_ptr->arena_number == MAX_ARENA_MONS)
394 msg_print(_("あなたは勝利者だ。 アリーナでのセレモニーに参加しなさい。",
395 "You are victorious. Enter the arena for the ceremony."));
397 else if (p_ptr->arena_number > MAX_ARENA_MONS)
399 msg_print(_("あなたはすべての敵に勝利した。", "You have won against all foes."));
403 r_ptr = &r_info[arena_info[p_ptr->arena_number].r_idx];
404 name = (r_name + r_ptr->name);
405 msg_format(_("%s に挑戦するものはいないか?", "Do I hear any challenges against: %s"), name);
407 p_ptr->monster_race_idx = arena_info[p_ptr->arena_number].r_idx;
408 p_ptr->window |= (PW_MONSTER);
413 case BACT_ARENA_RULES:
416 /* Peruse the arena help file */
417 (void)show_file(TRUE, _("arena_j.txt", "arena.txt"), NULL, 0, 0);
425 * @brief カジノのスロットシンボルを表示する / display fruit for dice slots
426 * @param row シンボルを表示する行の上端
427 * @param col シンボルを表示する行の左端
428 * @param fruit 表示するシンボルID
431 static void display_fruit(int row, int col, int fruit)
436 c_put_str(TERM_YELLOW, " ####.", row, col);
437 c_put_str(TERM_YELLOW, " # #", row + 1, col);
438 c_put_str(TERM_YELLOW, " # #", row + 2, col);
439 c_put_str(TERM_YELLOW, "# #", row + 3, col);
440 c_put_str(TERM_YELLOW, "# #", row + 4, col);
441 c_put_str(TERM_YELLOW, "# # ", row + 5, col);
442 c_put_str(TERM_YELLOW, "# # ", row + 6, col);
443 c_put_str(TERM_YELLOW, ".#### ", row + 7, col);
445 " Lemon "), row + 8, col);
448 c_put_str(TERM_ORANGE, " ## ", row, col);
449 c_put_str(TERM_ORANGE, " #..# ", row + 1, col);
450 c_put_str(TERM_ORANGE, " #....# ", row + 2, col);
451 c_put_str(TERM_ORANGE, "#......#", row + 3, col);
452 c_put_str(TERM_ORANGE, "#......#", row + 4, col);
453 c_put_str(TERM_ORANGE, " #....# ", row + 5, col);
454 c_put_str(TERM_ORANGE, " #..# ", row + 6, col);
455 c_put_str(TERM_ORANGE, " ## ", row + 7, col);
457 " Orange "), row + 8, col);
460 c_put_str(TERM_SLATE, _(" Λ ", " /\\ ") , row, col);
461 c_put_str(TERM_SLATE, _(" || ", " ## ") , row + 1, col);
462 c_put_str(TERM_SLATE, _(" || ", " ## ") , row + 2, col);
463 c_put_str(TERM_SLATE, _(" || ", " ## ") , row + 3, col);
464 c_put_str(TERM_SLATE, _(" || ", " ## ") , row + 4, col);
465 c_put_str(TERM_SLATE, _(" || ", " ## ") , row + 5, col);
466 c_put_str(TERM_UMBER, _(" |=亜=| ", " ###### ") , row + 6, col);
467 c_put_str(TERM_UMBER, _(" 目 ", " ## ") , row + 7, col);
468 prt( _(" 剣 ", " Sword ") , row + 8, col);
471 c_put_str(TERM_SLATE, " ###### ", row, col);
472 c_put_str(TERM_SLATE, "# #", row + 1, col);
473 c_put_str(TERM_SLATE, "# ++++ #", row + 2, col);
474 c_put_str(TERM_SLATE, "# +==+ #", row + 3, col);
475 c_put_str(TERM_SLATE, "# ++ #", row + 4, col);
476 c_put_str(TERM_SLATE, " # # ", row + 5, col);
477 c_put_str(TERM_SLATE, " # # ", row + 6, col);
478 c_put_str(TERM_SLATE, " ## ", row + 7, col);
480 " Shield "), row + 8, col);
483 c_put_str(TERM_VIOLET, " ## ", row, col);
484 c_put_str(TERM_VIOLET, " ###### ", row + 1, col);
485 c_put_str(TERM_VIOLET, "########", row + 2, col);
486 c_put_str(TERM_VIOLET, "########", row + 3, col);
487 c_put_str(TERM_VIOLET, "########", row + 4, col);
488 c_put_str(TERM_VIOLET, " ###### ", row + 5, col);
489 c_put_str(TERM_VIOLET, " #### ", row + 6, col);
490 c_put_str(TERM_VIOLET, " ## ", row + 7, col);
492 " Plum "), row + 8, col);
495 c_put_str(TERM_RED, " ##", row, col);
496 c_put_str(TERM_RED, " ### ", row + 1, col);
497 c_put_str(TERM_RED, " #..# ", row + 2, col);
498 c_put_str(TERM_RED, " #..# ", row + 3, col);
499 c_put_str(TERM_RED, " ###### ", row + 4, col);
500 c_put_str(TERM_RED, "#..##..#", row + 5, col);
501 c_put_str(TERM_RED, "#..##..#", row + 6, col);
502 c_put_str(TERM_RED, " ## ## ", row + 7, col);
504 " Cherry "), row + 8, col);
510 * kpoker no (tyuto-hannpa na)pakuri desu...
511 * joker ha shineru node haitte masen.
513 * TODO: donataka! tsukutte!
514 * - agatta yaku no kiroku (like DQ).
515 * - kakkoii card no e.
516 * - sousa-sei no koujyo.
517 * - code wo wakariyasuku.
519 * - Joker... -- done.
522 * 9/15/2000 joker wo jissou. soreto, code wo sukosi kakikae. --Habu
525 #define SUIT_OF(card) ((card) / 13) /*!< トランプカードのスートを返す */
526 #define NUM_OF(card) ((card) % 13) /*!< トランプカードの番号を返す */
527 #define IS_JOKER(card) ((card) == 52) /*!< トランプカードがジョーカーかどうかを返す */
529 static int cards[5]; /*!< ポーカーの現在の手札ID */
536 static void reset_deck(int deck[])
539 for (i = 0; i < 53; i++) deck[i] = i;
542 for (i = 0; i < 53; i++){
543 int tmp1 = randint0(53 - i) + i;
545 deck[i] = deck[tmp1];
551 * @brief ポーカープレイ中にジョーカーを持っているかの判定を返す。
552 * @return ジョーカーを持っているか。
554 static bool have_joker(void)
558 for (i = 0; i < 5; i++){
559 if(IS_JOKER(cards[i])) return TRUE;
565 * @brief ポーカーの手札に該当の番号の札があるかを返す。
566 * @param num 探したいカードの番号。
567 * @return 該当の番号が手札にあるか。
569 static bool find_card_num(int num)
572 for (i = 0; i < 5; i++)
573 if (NUM_OF(cards[i]) == num && !IS_JOKER(cards[i])) return TRUE;
578 * @brief ポーカーの手札がフラッシュ役を得ているかを帰す。
581 static bool yaku_check_flush(void)
584 bool joker_is_used = FALSE;
586 suit = IS_JOKER(cards[0]) ? SUIT_OF(cards[1]) : SUIT_OF(cards[0]);
587 for (i = 0; i < 5; i++){
588 if (SUIT_OF(cards[i]) != suit){
589 if(have_joker() && !joker_is_used)
590 joker_is_used = TRUE;
600 * @brief ポーカーの手札がストレートを含んだ高位の役を得ているかを帰す。
601 * @return 役の判定結果 0…ストレート、フラッシュいずれもなし/1…ストレートのみ/2…ストレートフラッシュ/3…ロイヤルストレートフラッシュ
603 static int yaku_check_straight(void)
606 bool joker_is_used = FALSE;
607 bool straight = FALSE;
610 for (i = 0; i < 5; i++)
612 if (NUM_OF(cards[i]) < lowest && !IS_JOKER(cards[i]))
613 lowest = NUM_OF(cards[i]);
616 /* Check Royal Straight Flush */
617 if (yaku_check_flush())
620 for (i = 0; i < 4; i++)
622 if (!find_card_num(9 + i)){
623 if( have_joker() && !joker_is_used )
624 joker_is_used = TRUE;
629 if (i == 4) return 3; /* Wow! Royal Straight Flush!!! */
632 for (i = 0; i < 3; i++)
634 if (!find_card_num(10 + i))
637 if (i == 3 && have_joker()) return 3; /* Wow! Royal Straight Flush!!! */
641 joker_is_used = FALSE;
643 /* Straight Only Check */
645 if (lowest == 0) { /* (10 - J - Q - K)[JOKER] - A */
646 for (i = 0; i < 4; i++)
648 if (!find_card_num(9 + i)) {
649 if (have_joker() && !joker_is_used)
650 joker_is_used = TRUE;
655 if(i == 4) straight = TRUE;
658 joker_is_used = FALSE;
660 for (i = 0; i < 5; i++)
662 if(!find_card_num(lowest + i)){
663 if( have_joker() && !joker_is_used )
664 joker_is_used = TRUE;
669 if(i == 5) straight = TRUE;
671 if (straight && yaku_check_flush()) return 2; /* Straight Flush */
672 else if(straight) return 1; /* Only Straight */
677 * @brief ポーカーのペア役の状態を返す。
678 * @return 0:nopair 1:1 pair 2:2 pair 3:3 cards 4:full house 6:4cards
680 static int yaku_check_pair(void)
682 int i, i2, matching = 0;
684 for (i = 0; i < 5; i++)
686 for (i2 = i+1; i2 < 5; i2++)
688 if (IS_JOKER(cards[i]) || IS_JOKER(cards[i2])) continue;
689 if (NUM_OF(cards[i]) == NUM_OF(cards[i2]))
720 #define ODDS_5A 3000 /*!< ファイブエースの役倍率 */
721 #define ODDS_5C 400 /*!< ファイブカードの役倍率 */
722 #define ODDS_RF 200 /*!< ロイヤルストレートフラッシュの役倍率 */
723 #define ODDS_SF 80 /*!< ストレートフラッシュの役倍率 */
724 #define ODDS_4C 16 /*!< フォアカードの役倍率 */
725 #define ODDS_FH 12 /*!< フルハウスの役倍率 */
726 #define ODDS_FL 8 /*!< フラッシュの役倍率 */
727 #define ODDS_ST 4 /*!< ストレートの役倍率 */
728 #define ODDS_3C 1 /*!< スリーカードの役倍率 */
729 #define ODDS_2P 1 /*!< ツーペアの役倍率 */
732 * @brief ポーカーの役をチェックし、その結果を画面に表示しつつ結果を返す。
735 static int yaku_check(void)
739 switch(yaku_check_straight()){
741 c_put_str(TERM_YELLOW, _("ロイヤルストレートフラッシュ", "Royal Flush"), 4, 3);
744 c_put_str(TERM_YELLOW, _("ストレートフラッシュ", "Straight Flush"), 4, 3);
747 c_put_str(TERM_YELLOW, _("ストレート", "Straight"), 4, 3);
750 /* Not straight -- fall through */
754 if (yaku_check_flush())
756 c_put_str(TERM_YELLOW, _("フラッシュ", "Flush"), 4, 3);
760 switch (yaku_check_pair())
763 c_put_str(TERM_YELLOW, _("ワンペア", "One pair"), 4, 3);
766 c_put_str(TERM_YELLOW, _("ツーペア", "Two pair"), 4, 3);
769 c_put_str(TERM_YELLOW, _("スリーカード", "Three of a kind"), 4, 3);
772 c_put_str(TERM_YELLOW, _("フルハウス", "Full house"), 4, 3);
775 c_put_str(TERM_YELLOW, _("フォーカード", "Four of a kind"), 4, 3);
778 if (!NUM_OF(cards[0]) && !NUM_OF(cards[1]))
780 c_put_str(TERM_YELLOW, _("ファイブエース", "Five ace"), 4, 3);
785 c_put_str(TERM_YELLOW, _("ファイブカード", "Five of a kind"), 4, 3);
795 * @brief ポーカーの捨てる/残すインターフェイスの表示を更新する。
796 * @param hoge カーソルの現在位置
797 * @param kaeruka カードの捨てる/残すフラグ配列
800 static void display_kaeruka(int hoge, int kaeruka[])
803 char col = TERM_WHITE;
804 for (i = 0; i < 5; i++)
806 if (i == hoge) col = TERM_YELLOW;
807 else if(kaeruka[i]) col = TERM_WHITE;
808 else col = TERM_L_BLUE;
811 c_put_str(col, _("かえる", "Change"), 14, 5+i*16);
813 c_put_str(col, _("のこす", " Stay "), 14, 5+i*16);
815 if (hoge > 4) col = TERM_YELLOW;
816 else col = TERM_WHITE;
817 c_put_str(col, _("決定", "Sure"), 16, 38);
819 /* Hilite current option */
820 if (hoge < 5) move_cursor(14, 5+hoge*16);
821 else move_cursor(16, 38);
825 * @brief ポーカーの手札を表示する。
828 static void display_cards(void)
831 char suitcolor[4] = {TERM_YELLOW, TERM_L_RED, TERM_L_BLUE, TERM_L_GREEN};
833 concptr suit[4] = {"★", "●", "¶", "†"};
834 concptr card_grph[13][7] = {{"A %s ",
925 concptr joker_grph[7] = { " ",
935 concptr suit[4] = {"[]", "qp", "<>", "db"};
936 concptr card_grph[13][7] = {{"A %s ",
1027 concptr joker_grph[7] = { " ",
1036 for (i = 0; i < 5; i++)
1038 prt(_("┏━━━━━━┓", " +------------+ "), 5, i*16);
1041 for (i = 0; i < 5; i++)
1043 for (j = 0; j < 7; j++)
1045 prt(_("┃", " |"), j+6, i*16);
1046 if(IS_JOKER(cards[i]))
1047 c_put_str(TERM_VIOLET, joker_grph[j], j+6, 2+i*16);
1049 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);
1050 prt(_("┃", "| "), j+6, i*16+14);
1053 for (i = 0; i < 5; i++)
1055 prt(_("┗━━━━━━┛", " +------------+ "), 13, i*16);
1060 * @brief ポーカーの1プレイルーチン。
1063 static int do_poker(void)
1067 int deck[53]; /* yamafuda : 0...52 */
1069 int kaeruka[5]; /* 0:kaenai 1:kaeru */
1073 bool kakikae = TRUE;
1077 for (i = 0; i < 5; i++)
1079 cards[i] = deck[deck_ptr++];
1080 kaeruka[i] = 0; /* default:nokosu */
1083 /* suteruno wo kimeru */
1084 prt(_("残すカードを決めて下さい(方向で移動, スペースで選択)。", "Stay witch? "), 0, 0);
1091 if (kakikae) display_kaeruka(k+kettei*5, kaeruka);
1096 case '6': case 'l': case 'L': case KTRL('F'):
1097 if (!kettei) k = (k+1)%5;
1098 else {k = 0;kettei = FALSE;}
1101 case '4': case 'h': case 'H': case KTRL('B'):
1102 if (!kettei) k = (k+4)%5;
1103 else {k = 4;kettei = FALSE;}
1106 case '2': case 'j': case 'J': case KTRL('N'):
1107 if (!kettei) {kettei = TRUE;kakikae = TRUE;}
1109 case '8': case 'k': case 'K': case KTRL('P'):
1110 if (kettei) {kettei = FALSE;kakikae = TRUE;}
1112 case ' ': case '\r':
1113 if (kettei) done = TRUE;
1114 else {kaeruka[k] = !kaeruka[k];kakikae = TRUE;}
1123 for (i = 0; i < 5; i++)
1124 if (kaeruka[i] == 1) cards[i] = deck[deck_ptr++]; /* soshite toru */
1128 return yaku_check();
1133 /* end of poker codes --Koka */
1136 * @brief カジノ1プレイごとのメインルーチン / gamble_comm
1137 * @param cmd プレイするゲームID
1140 static bool gamble_comm(int cmd)
1143 int roll1, roll2, roll3, choice, odds, win;
1148 char out_val[160], tmp_str[80], again;
1153 if (cmd == BACT_GAMBLE_RULES)
1155 /* Peruse the gambling help file */
1156 (void)show_file(TRUE, _("jgambling.txt", "gambling.txt"), NULL, 0, 0);
1163 msg_print(_("おい!おまえ一文なしじゃないか!こっから出ていけ!",
1164 "Hey! You don't have gold - get out of here!"));
1172 maxbet = p_ptr->lev * 200;
1174 /* We can't bet more than we have */
1175 maxbet = MIN(maxbet, p_ptr->au);
1178 strcpy(out_val, "");
1179 sprintf(tmp_str,_("賭け金 (1-%ld)?", "Your wager (1-%ld) ? "), (long int)maxbet);
1183 * Use get_string() because we may need more than
1184 * the s16b value returned by get_quantity().
1186 if (get_string(tmp_str, out_val, 32))
1189 for (p = out_val; *p == ' '; p++);
1194 if (wager > p_ptr->au)
1196 msg_print(_("おい!金が足りないじゃないか!出ていけ!", "Hey! You don't have the gold - get out of here!"));
1201 else if (wager > maxbet)
1203 msg_format(_("%ldゴールドだけ受けよう。残りは取っときな。",
1204 "I'll take %ld gold of that. Keep the rest."), (long int)maxbet);
1209 msg_print(_("OK、1ゴールドからはじめよう。", "Ok, we'll start with 1 gold."));
1215 oldgold = p_ptr->au;
1217 sprintf(tmp_str, _("ゲーム前の所持金: %9ld", "Gold before game: %9ld"), (long int)oldgold);
1218 prt(tmp_str, 20, 2);
1219 sprintf(tmp_str, _("現在の掛け金: %9ld", "Current Wager: %9ld"), (long int)wager);
1220 prt(tmp_str, 21, 2);
1227 case BACT_IN_BETWEEN: /* Game of In-Between */
1228 c_put_str(TERM_GREEN, _("イン・ビトイーン", "In Between"),5,2);
1232 roll1 = randint1(10);
1233 roll2 = randint1(10);
1234 choice = randint1(10);
1235 sprintf(tmp_str, _("黒ダイス: %d 黒ダイス: %d", "Black die: %d Black Die: %d"), roll1, roll2);
1238 sprintf(tmp_str, _("赤ダイス: %d", "Red die: %d"), choice);
1240 prt(tmp_str, 11, 14);
1241 if (((choice > roll1) && (choice < roll2)) ||
1242 ((choice < roll1) && (choice > roll2)))
1245 case BACT_CRAPS: /* Game of Craps */
1246 c_put_str(TERM_GREEN, _("クラップス", "Craps"), 5, 2);
1250 roll1 = randint1(6);
1251 roll2 = randint1(6);
1252 roll3 = roll1 + roll2;
1254 sprintf(tmp_str, _("1振りめ: %d %d Total: %d",
1255 "First roll: %d %d Total: %d"), roll1, roll2, roll3);
1257 if ((roll3 == 7) || (roll3 == 11))
1259 else if ((roll3 == 2) || (roll3 == 3) || (roll3 == 12))
1264 msg_print(_("なにかキーを押すともう一回振ります。", "Hit any key to roll again"));
1267 roll1 = randint1(6);
1268 roll2 = randint1(6);
1269 roll3 = roll1 + roll2;
1270 sprintf(tmp_str, _("出目: %d %d 合計: %d",
1271 "Roll result: %d %d Total: %d"), roll1, roll2, roll3);
1273 if (roll3 == choice)
1275 else if (roll3 == 7)
1277 } while ((win != TRUE) && (win != FALSE));
1280 case BACT_SPIN_WHEEL: /* Spin the Wheel Game */
1283 c_put_str(TERM_GREEN, _("ルーレット", "Wheel"), 5, 2);
1285 prt("0 1 2 3 4 5 6 7 8 9", 7, 5);
1286 prt("--------------------------------", 8, 3);
1287 strcpy(out_val, "");
1288 get_string(_("何番? (0-9): ", "Pick a number (0-9): "), out_val, 32);
1290 for (p = out_val; iswspace(*p); p++);
1294 msg_print(_("0番にしとくぜ。", "I'll put you down for 0."));
1297 else if (choice > 9)
1299 msg_print(_("OK、9番にしとくぜ。", "Ok, I'll put you down for 9."));
1303 roll1 = randint0(10);
1304 sprintf(tmp_str, _("ルーレットは回り、止まった。勝者は %d番だ。",
1305 "The wheel spins to a stop and the winner is %d"), roll1);
1306 prt(tmp_str, 13, 3);
1308 prt("*", 9, (3 * roll1 + 5));
1309 if (roll1 == choice)
1313 case BACT_DICE_SLOTS: /* The Dice Slots */
1314 c_put_str(TERM_GREEN, _("ダイス・スロット", "Dice Slots"), 5, 2);
1315 c_put_str(TERM_YELLOW, _("レモン レモン 2", ""), 6, 37);
1316 c_put_str(TERM_YELLOW, _("レモン レモン レモン 5", ""), 7, 37);
1317 c_put_str(TERM_ORANGE, _("オレンジ オレンジ オレンジ 10", ""), 8, 37);
1318 c_put_str(TERM_UMBER, _("剣 剣 剣 20", ""), 9, 37);
1319 c_put_str(TERM_SLATE, _("盾 盾 盾 50", ""), 10, 37);
1320 c_put_str(TERM_VIOLET, _("プラム プラム プラム 200", ""), 11, 37);
1321 c_put_str(TERM_RED, _("チェリー チェリー チェリー 1000", ""), 12, 37);
1324 roll1 = randint1(21);
1334 roll2 = randint1(21);
1344 choice = randint1(21);
1354 put_str("/--------------------------\\", 7, 2);
1355 prt("\\--------------------------/", 17, 2);
1356 display_fruit(8, 3, roll1 - 1);
1357 display_fruit(8, 12, roll2 - 1);
1358 display_fruit(8, 21, choice - 1);
1359 if ((roll1 == roll2) && (roll2 == choice))
1378 else if ((roll1 == 1) && (roll2 == 1))
1387 if (odds) win = TRUE;
1393 prt(_("あなたの勝ち", "YOU WON"), 16, 37);
1395 p_ptr->au += odds * wager;
1396 sprintf(tmp_str, _("倍率: %d", "Payoff: %d"), odds);
1398 prt(tmp_str, 17, 37);
1402 prt(_("あなたの負け", "You Lost"), 16, 37);
1405 sprintf(tmp_str, _("現在の所持金: %9ld", "Current Gold: %9ld"), (long int)p_ptr->au);
1407 prt(tmp_str, 22, 2);
1408 prt(_("もう一度(Y/N)?", "Again(Y/N)?"), 18, 37);
1410 move_cursor(18, 52);
1415 if (wager > p_ptr->au)
1417 msg_print(_("おい!金が足りないじゃないか!ここから出て行け!",
1418 "Hey! You don't have the gold - get out of here!"));
1424 } while ((again == 'y') || (again == 'Y'));
1427 if (p_ptr->au >= oldgold)
1429 msg_print(_("「今回は儲けたな!でも次はこっちが勝ってやるからな、絶対に!」",
1430 "You came out a winner! We'll win next time, I'm sure."));
1431 chg_virtue(p_ptr, V_CHANCE, 3);
1435 msg_print(_("「金をスッてしまったな、わはは!うちに帰った方がいいぜ。」", "You lost gold! Haha, better head home."));
1436 chg_virtue(p_ptr, V_CHANCE, -3);
1446 * @brief モンスター闘技場に参加するモンスターを更新する。
1449 void update_gambling_monsters(void)
1456 bool old_inside_battle = p_ptr->phase_out;
1458 for (i = 0; i < max_d_idx; i++)
1459 if (max_dl < max_dlv[i]) max_dl = max_dlv[i];
1461 mon_level = randint1(MIN(max_dl, 122)) + 5;
1462 if (randint0(100) < 60)
1464 i = randint1(MIN(max_dl, 122)) + 5;
1465 mon_level = MAX(i, mon_level);
1467 if (randint0(100) < 30)
1469 i = randint1(MIN(max_dl, 122)) + 5;
1470 mon_level = MAX(i, mon_level);
1477 for (i = 0; i < 4; i++)
1483 get_mon_num_prep(monster_can_entry_arena, NULL);
1484 p_ptr->phase_out = TRUE;
1485 r_idx = get_mon_num(mon_level);
1486 p_ptr->phase_out = old_inside_battle;
1487 if (!r_idx) continue;
1489 if ((r_info[r_idx].flags1 & RF1_UNIQUE) || (r_info[r_idx].flags7 & RF7_UNIQUE2))
1491 if ((r_info[r_idx].level + 10) > mon_level) continue;
1494 for (j = 0; j < i; j++)
1495 if (r_idx == battle_mon[j]) break;
1496 if (j < i) continue;
1500 battle_mon[i] = r_idx;
1501 if (r_info[r_idx].level < 45) tekitou = TRUE;
1504 for (i = 0; i < 4; i++)
1506 monster_race *r_ptr = &r_info[battle_mon[i]];
1507 int num_taisei = count_bits(r_ptr->flagsr & (RFR_IM_ACID | RFR_IM_ELEC | RFR_IM_FIRE | RFR_IM_COLD | RFR_IM_POIS));
1509 if (r_ptr->flags1 & RF1_FORCE_MAXHP)
1510 power[i] = r_ptr->hdice * r_ptr->hside * 2;
1512 power[i] = r_ptr->hdice * (r_ptr->hside + 1);
1513 power[i] = power[i] * (100 + r_ptr->level) / 100;
1514 if (r_ptr->speed > 110)
1515 power[i] = power[i] * (r_ptr->speed * 2 - 110) / 100;
1516 if (r_ptr->speed < 110)
1517 power[i] = power[i] * (r_ptr->speed - 20) / 100;
1519 power[i] = power[i] * (num_taisei * 2 + 5) / 10;
1520 else if (r_ptr->a_ability_flags2 & RF6_INVULNER)
1521 power[i] = power[i] * 4 / 3;
1522 else if (r_ptr->a_ability_flags2 & RF6_HEAL)
1523 power[i] = power[i] * 4 / 3;
1524 else if (r_ptr->a_ability_flags1 & RF5_DRAIN_MANA)
1525 power[i] = power[i] * 11 / 10;
1526 if (r_ptr->flags1 & RF1_RAND_25)
1527 power[i] = power[i] * 9 / 10;
1528 if (r_ptr->flags1 & RF1_RAND_50)
1529 power[i] = power[i] * 9 / 10;
1530 if (r_ptr->flagsr & RFR_RES_ALL) power[i] *= 100000;
1531 if (r_ptr->arena_ratio) power[i] = power[i] * r_ptr->arena_ratio / 100;
1536 for (i = 0; i < 4; i++)
1538 power[i] = total * 60 / power[i];
1539 if (tekitou && ((power[i] < 160) || power[i] > 1500)) break;
1540 if ((power[i] < 160) && randint0(20)) break;
1541 if (power[i] < 101) power[i] = 100 + randint1(5);
1542 mon_odds[i] = power[i];
1549 * @brief モンスター闘技場のメインルーチン
1550 * @return 賭けを開始したか否か
1552 static bool kakutoujou(void)
1556 char out_val[160], tmp_str[80];
1559 if ((current_world_ptr->game_turn - current_world_ptr->arena_start_turn) > TURNS_PER_TICK * 250)
1561 update_gambling_monsters();
1562 current_world_ptr->arena_start_turn = current_world_ptr->game_turn;
1570 msg_print(_("おい!おまえ一文なしじゃないか!こっから出ていけ!", "Hey! You don't have gold - get out of here!"));
1582 "Monsters Odds"), 4, 4);
1586 monster_race *r_ptr = &r_info[battle_mon[i]];
1588 sprintf(buf, _("%d) %-58s %4ld.%02ld倍", "%d) %-58s %4ld.%02ld"), i+1,
1589 _(format("%s%s",r_name + r_ptr->name, (r_ptr->flags1 & RF1_UNIQUE) ? "もどき" : " "),
1590 format("%s%s", (r_ptr->flags1 & RF1_UNIQUE) ? "Fake " : "", r_name + r_ptr->name)),
1591 (long int)mon_odds[i]/100, (long int)mon_odds[i]%100);
1594 prt(_("どれに賭けますか:", "Which monster: "), 0, 0);
1604 if (i >= '1' && i <= '4')
1606 sel_monster = i-'1';
1607 battle_odds = mon_odds[sel_monster];
1614 for (i = 0; i < 4; i++)
1615 if (i != sel_monster) clear_bldg(i + 5, i + 5);
1617 maxbet = p_ptr->lev * 200;
1619 /* We can't bet more than we have */
1620 maxbet = MIN(maxbet, p_ptr->au);
1623 strcpy(out_val, "");
1624 sprintf(tmp_str,_("賭け金 (1-%ld)?", "Your wager (1-%ld) ? "), (long int)maxbet);
1626 * Use get_string() because we may need more than
1627 * the s16b value returned by get_quantity().
1629 if (get_string(tmp_str, out_val, 32))
1632 for (p = out_val; *p == ' '; p++);
1637 if (wager > p_ptr->au)
1639 msg_print(_("おい!金が足りないじゃないか!出ていけ!", "Hey! You don't have the gold - get out of here!"));
1645 else if (wager > maxbet)
1647 msg_format(_("%ldゴールドだけ受けよう。残りは取っときな。", "I'll take %ld gold of that. Keep the rest."), (long int)maxbet);
1653 msg_print(_("OK、1ゴールドでいこう。", "Ok, we'll start with 1 gold."));
1657 battle_odds = MAX(wager+1, wager * battle_odds / 100);
1660 reset_tim_flags(p_ptr);
1662 /* Save the surface floor as saved floor */
1663 prepare_change_floor_mode(CFM_SAVE_FLOORS);
1665 p_ptr->phase_out = TRUE;
1666 p_ptr->leaving = TRUE;
1667 p_ptr->leave_bldg = TRUE;
1680 * @brief 本日の賞金首情報を表示する。
1683 static void today_target(void)
1686 monster_race *r_ptr = &r_info[today_mon];
1689 c_put_str(TERM_YELLOW, _("本日の賞金首", "Wanted monster that changes from day to day"), 5, 10);
1690 sprintf(buf,_("ターゲット: %s", "target: %s"),r_name + r_ptr->name);
1691 c_put_str(TERM_YELLOW, buf, 6, 10);
1692 sprintf(buf,_("死体 ---- $%d", "corpse ---- $%d"), (int)r_ptr->level * 50 + 100);
1694 sprintf(buf,_("骨 ---- $%d", "skeleton ---- $%d"), (int)r_ptr->level * 30 + 60);
1696 p_ptr->today_mon = today_mon;
1700 * @brief ツチノコの賞金首情報を表示する。
1703 static void tsuchinoko(void)
1706 c_put_str(TERM_YELLOW, _("一獲千金の大チャンス!!!", "Big chance to quick money!!!"), 5, 10);
1707 c_put_str(TERM_YELLOW, _("ターゲット:幻の珍獣「ツチノコ」", "target: the rarest animal 'Tsuchinoko'"), 6, 10);
1708 c_put_str(TERM_WHITE, _("生け捕り ---- $1,000,000", "catch alive ---- $1,000,000"), 8, 10);
1709 c_put_str(TERM_WHITE, _("死体 ---- $200,000", "corpse ---- $200,000"), 9, 10);
1710 c_put_str(TERM_WHITE, _("骨 ---- $100,000", "bones ---- $100,000"), 10, 10);
1714 * @brief 通常の賞金首情報を表示する。
1717 static void shoukinkubi(void)
1723 prt(_("死体を持ち帰れば報酬を差し上げます。", "Offer a prize when you bring a wanted monster's corpse"),4 ,10);
1724 c_put_str(TERM_YELLOW, _("現在の賞金首", "Wanted monsters"), 6, 10);
1726 for (i = 0; i < MAX_KUBI; i++)
1730 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])];
1732 if (current_world_ptr->bounty_r_idx[i] > 10000)
1735 done_mark = _("(済)", "(done)");
1743 c_prt(color, format("%s %s", r_name + r_ptr->name, done_mark), y+7, 10);
1746 if (!y && (i < MAX_KUBI -1))
1748 prt(_("何かキーを押してください", "Hit any key."), 0, 0);
1759 * 賞金首の報酬テーブル / List of prize object
1762 OBJECT_TYPE_VALUE tval; /*!< ベースアイテムのメイン種別ID */
1763 OBJECT_SUBTYPE_VALUE sval; /*!< ベースアイテムのサブ種別ID */
1764 } prize_list[MAX_KUBI] =
1766 {TV_POTION, SV_POTION_CURING},
1767 {TV_POTION, SV_POTION_SPEED},
1768 {TV_POTION, SV_POTION_SPEED},
1769 {TV_POTION, SV_POTION_RESISTANCE},
1770 {TV_POTION, SV_POTION_ENLIGHTENMENT},
1772 {TV_POTION, SV_POTION_HEALING},
1773 {TV_POTION, SV_POTION_RESTORE_MANA},
1774 {TV_SCROLL, SV_SCROLL_STAR_DESTRUCTION},
1775 {TV_POTION, SV_POTION_STAR_ENLIGHTENMENT},
1776 {TV_SCROLL, SV_SCROLL_SUMMON_PET},
1778 {TV_SCROLL, SV_SCROLL_GENOCIDE},
1779 {TV_POTION, SV_POTION_STAR_HEALING},
1780 {TV_POTION, SV_POTION_STAR_HEALING},
1781 {TV_POTION, SV_POTION_NEW_LIFE},
1782 {TV_SCROLL, SV_SCROLL_MASS_GENOCIDE},
1784 {TV_POTION, SV_POTION_LIFE},
1785 {TV_POTION, SV_POTION_LIFE},
1786 {TV_POTION, SV_POTION_AUGMENTATION},
1787 {TV_POTION, SV_POTION_INVULNERABILITY},
1788 {TV_SCROLL, SV_SCROLL_ARTIFACT},
1792 * @brief 賞金首の引き換え処理 / Get prize
1793 * @return 各種賞金首のいずれかでも換金が行われたか否か。
1795 static bool kankin(void)
1799 bool change = FALSE;
1800 GAME_TEXT o_name[MAX_NLEN];
1803 /* Loop for p_ptr->inventory_list and right/left arm */
1804 for (i = 0; i <= INVEN_LARM; i++)
1806 o_ptr = &p_ptr->inventory_list[i];
1808 /* Living Tsuchinoko worthes $1000000 */
1809 if ((o_ptr->tval == TV_CAPTURE) && (o_ptr->pval == MON_TSUCHINOKO))
1811 char buf[MAX_NLEN+20];
1812 object_desc(o_name, o_ptr, 0);
1813 sprintf(buf, _("%s を換金しますか?", "Convert %s into money? "),o_name);
1816 msg_format(_("賞金 %ld$を手に入れた。", "You get %ldgp."), (long int)(1000000L * o_ptr->number));
1817 p_ptr->au += 1000000L * o_ptr->number;
1818 p_ptr->redraw |= (PR_GOLD);
1819 inven_item_increase(i, -o_ptr->number);
1820 inven_item_describe(i);
1821 inven_item_optimize(i);
1827 for (i = 0; i < INVEN_PACK; i++)
1829 o_ptr = &p_ptr->inventory_list[i];
1831 /* Corpse of Tsuchinoko worthes $200000 */
1832 if ((o_ptr->tval == TV_CORPSE) && (o_ptr->sval == SV_CORPSE) && (o_ptr->pval == MON_TSUCHINOKO))
1834 char buf[MAX_NLEN+20];
1835 object_desc(o_name, o_ptr, 0);
1836 sprintf(buf, _("%s を換金しますか?", "Convert %s into money? "),o_name);
1839 msg_format(_("賞金 %ld$を手に入れた。", "You get %ldgp."), (long int)(200000L * o_ptr->number));
1840 p_ptr->au += 200000L * o_ptr->number;
1841 p_ptr->redraw |= (PR_GOLD);
1842 inven_item_increase(i, -o_ptr->number);
1843 inven_item_describe(i);
1844 inven_item_optimize(i);
1850 for (i = 0; i < INVEN_PACK; i++)
1852 o_ptr = &p_ptr->inventory_list[i];
1854 /* Bones of Tsuchinoko worthes $100000 */
1855 if ((o_ptr->tval == TV_CORPSE) && (o_ptr->sval == SV_SKELETON) && (o_ptr->pval == MON_TSUCHINOKO))
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)(100000L * o_ptr->number));
1863 p_ptr->au += 100000L * 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 = &p_ptr->inventory_list[i];
1876 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)))
1878 char buf[MAX_NLEN+20];
1879 object_desc(o_name, o_ptr, 0);
1880 sprintf(buf, _("%s を換金しますか?", "Convert %s into money? "),o_name);
1883 msg_format(_("賞金 %ld$を手に入れた。", "You get %ldgp."), (long int)((r_info[today_mon].level * 50 + 100) * o_ptr->number));
1884 p_ptr->au += (r_info[today_mon].level * 50 + 100) * o_ptr->number;
1885 p_ptr->redraw |= (PR_GOLD);
1886 inven_item_increase(i, -o_ptr->number);
1887 inven_item_describe(i);
1888 inven_item_optimize(i);
1894 for (i = 0; i < INVEN_PACK; i++)
1896 o_ptr = &p_ptr->inventory_list[i];
1898 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)))
1900 char buf[MAX_NLEN+20];
1901 object_desc(o_name, o_ptr, 0);
1902 sprintf(buf, _("%s を換金しますか?", "Convert %s into money? "),o_name);
1905 msg_format(_("賞金 %ld$を手に入れた。", "You get %ldgp."), (long int)((r_info[today_mon].level * 30 + 60) * o_ptr->number));
1906 p_ptr->au += (r_info[today_mon].level * 30 + 60) * o_ptr->number;
1907 p_ptr->redraw |= (PR_GOLD);
1908 inven_item_increase(i, -o_ptr->number);
1909 inven_item_describe(i);
1910 inven_item_optimize(i);
1916 for (j = 0; j < MAX_KUBI; j++)
1918 /* Need reverse order --- Positions will be changed in the loop */
1919 for (i = INVEN_PACK-1; i >= 0; i--)
1921 o_ptr = &p_ptr->inventory_list[i];
1922 if ((o_ptr->tval == TV_CORPSE) && (o_ptr->pval == current_world_ptr->bounty_r_idx[j]))
1924 char buf[MAX_NLEN+20];
1926 INVENTORY_IDX item_new;
1929 object_desc(o_name, o_ptr, 0);
1930 sprintf(buf, _("%sを渡しますか?", "Hand %s over? "),o_name);
1931 if (!get_check(buf)) continue;
1933 #if 0 /* Obsoleted */
1934 msg_format(_("賞金 %ld$を手に入れた。", "You get %ldgp."), (r_info[current_world_ptr->bounty_r_idx[j]].level + 1) * 300 * o_ptr->number);
1935 p_ptr->au += (r_info[current_world_ptr->bounty_r_idx[j]].level+1) * 300 * o_ptr->number;
1936 p_ptr->redraw |= (PR_GOLD);
1937 inven_item_increase(i, -o_ptr->number);
1938 inven_item_describe(i);
1939 inven_item_optimize(i);
1940 chg_virtue(p_ptr, V_JUSTICE, 5);
1941 current_world_ptr->bounty_r_idx[j] += 10000;
1944 #endif /* Obsoleted */
1947 inven_item_increase(i, -o_ptr->number);
1948 inven_item_describe(i);
1949 inven_item_optimize(i);
1951 chg_virtue(p_ptr, V_JUSTICE, 5);
1952 current_world_ptr->bounty_r_idx[j] += 10000;
1954 /* Count number of unique corpses already handed */
1955 for (num = 0, k = 0; k < MAX_KUBI; k++)
1957 if (current_world_ptr->bounty_r_idx[k] >= 10000) num++;
1959 msg_format(_("これで合計 %d ポイント獲得しました。" ,"You earned %d point%s total."), num, (num > 1 ? "s" : ""));
1961 /* Prepare to make a prize */
1962 object_prep(&forge, lookup_kind(prize_list[num-1].tval, prize_list[num-1].sval));
1963 apply_magic(&forge, current_floor_ptr->object_level, AM_NO_FIXED_ART);
1965 object_aware(&forge);
1966 object_known(&forge);
1969 * Hand it --- Assume there is an empty slot.
1970 * Since a corpse is handed at first,
1971 * there is at least one empty slot.
1973 item_new = inven_carry(&forge);
1975 object_desc(o_name, &forge, 0);
1976 msg_format(_("%s(%c)を貰った。", "You get %s (%c). "), o_name, index_to_label(item_new));
1978 /* Auto-inscription */
1979 autopick_alter_item(item_new, FALSE);
1989 msg_print(_("賞金を得られそうなものは持っていなかった。", "You have nothing."));
1997 * @brief 宿屋の利用サブルーチン
1998 * @details inn commands\n
1999 * Note that resting for the night was a perfect way to avoid player\n
2000 * ghosts in the town *if* you could only make it to the inn in time (-:\n
2001 * Now that the ghosts are temporarily disabled in 2.8.X, this function\n
2002 * will not be that useful. I will keep it in the hopes the player\n
2003 * ghost code does become a reality again. Does help to avoid filthy urchins.\n
2004 * Resting at night is also a quick way to restock stores -KMW-\n
2005 * @param cmd 宿屋の利用施設ID
2006 * @return 施設の利用が実際に行われたか否か。
2008 static bool inn_comm(int cmd)
2012 case BACT_FOOD: /* Buy food & drink */
2013 if (p_ptr->food >= PY_FOOD_FULL)
2015 msg_print(_("今は満腹だ。", "You are full now."));
2018 msg_print(_("バーテンはいくらかの食べ物とビールをくれた。", "The barkeep gives you some gruel and a beer."));
2019 (void)set_food(p_ptr, PY_FOOD_MAX - 1);
2022 case BACT_REST: /* Rest for the night */
2023 if ((p_ptr->poisoned) || (p_ptr->cut))
2025 msg_print(_("あなたに必要なのは部屋ではなく、治療者です。", "You need a healer, not a room."));
2027 msg_print(_("すみません、でもうちで誰かに死なれちゃ困りますんで。", "Sorry, but don't want anyone dying in here."));
2031 s32b oldturn = current_world_ptr->game_turn;
2032 int prev_day, prev_hour, prev_min;
2034 extract_day_hour_min(&prev_day, &prev_hour, &prev_min);
2035 if ((prev_hour >= 6) && (prev_hour <= 17))
2036 exe_write_diary(p_ptr, NIKKI_BUNSHOU, 0, _("宿屋に泊まった。", "stay over daytime at the inn."));
2038 exe_write_diary(p_ptr, NIKKI_BUNSHOU, 0, _("宿屋に泊まった。", "stay over night at the inn."));
2040 current_world_ptr->game_turn = (current_world_ptr->game_turn / (TURNS_PER_TICK * TOWN_DAWN / 2) + 1) * (TURNS_PER_TICK * TOWN_DAWN / 2);
2041 if (current_world_ptr->dungeon_turn < current_world_ptr->dungeon_turn_limit)
2043 current_world_ptr->dungeon_turn += MIN((current_world_ptr->game_turn - oldturn), TURNS_PER_TICK * 250) * INN_DUNGEON_TURN_ADJ;
2044 if (current_world_ptr->dungeon_turn > current_world_ptr->dungeon_turn_limit) current_world_ptr->dungeon_turn = current_world_ptr->dungeon_turn_limit;
2047 prevent_turn_overflow();
2049 if ((prev_hour >= 18) && (prev_hour <= 23)) exe_write_diary(p_ptr, NIKKI_HIGAWARI, 0, NULL);
2050 p_ptr->chp = p_ptr->mhp;
2052 if (ironman_nightmare)
2054 msg_print(_("眠りに就くと恐ろしい光景が心をよぎった。", "Horrible visions flit through your mind as you sleep."));
2056 /* Have some nightmares */
2059 sanity_blast(p_ptr, NULL, FALSE);
2060 if (!one_in_(3)) break;
2063 msg_print(_("あなたは絶叫して目を覚ました。", "You awake screaming."));
2064 exe_write_diary(p_ptr, NIKKI_BUNSHOU, 0, _("悪夢にうなされてよく眠れなかった。", "be troubled by a nightmare."));
2068 set_blind(p_ptr, 0);
2069 set_confused(p_ptr, 0);
2071 p_ptr->chp = p_ptr->mhp;
2072 p_ptr->csp = p_ptr->msp;
2073 if (p_ptr->pclass == CLASS_MAGIC_EATER)
2076 for (i = 0; i < 72; i++)
2078 p_ptr->magic_num1[i] = p_ptr->magic_num2[i] * EATER_CHARGE;
2080 for (; i < 108; i++)
2082 p_ptr->magic_num1[i] = 0;
2086 if ((prev_hour >= 6) && (prev_hour <= 17))
2088 msg_print(_("あなたはリフレッシュして目覚め、夕方を迎えた。", "You awake refreshed for the evening."));
2089 exe_write_diary(p_ptr, NIKKI_BUNSHOU, 0, _("夕方を迎えた。", "awake refreshed."));
2093 msg_print(_("あなたはリフレッシュして目覚め、新たな日を迎えた。", "You awake refreshed for the new day."));
2094 exe_write_diary(p_ptr, NIKKI_BUNSHOU, 0, _("すがすがしい朝を迎えた。", "awake refreshed."));
2100 case BACT_RUMORS: /* Listen for rumors */
2102 display_rumor(TRUE);
2112 * @brief クエスト情報を表示しつつ処理する。/ Display quest information
2113 * @param questnum クエストのID
2114 * @param do_init クエストの開始処理(TRUE)、結果処理か(FALSE)
2117 static void get_questinfo(IDX questnum, bool do_init)
2120 QUEST_IDX old_quest;
2121 GAME_TEXT tmp_str[80];
2123 /* Clear the text */
2124 for (i = 0; i < 10; i++)
2126 quest_text[i][0] = '\0';
2129 quest_text_line = 0;
2131 /* Set the quest number temporary */
2132 old_quest = p_ptr->inside_quest;
2133 p_ptr->inside_quest = questnum;
2135 /* Get the quest text */
2136 init_flags = INIT_SHOW_TEXT;
2137 if (do_init) init_flags |= INIT_ASSIGN;
2139 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
2141 /* Reset the old quest number */
2142 p_ptr->inside_quest = old_quest;
2144 /* Print the quest info */
2145 sprintf(tmp_str, _("クエスト情報 (危険度: %d 階相当)", "Quest Information (Danger level: %d)"), (int)quest[questnum].level);
2149 prt(quest[questnum].name, 7, 0);
2151 for (i = 0; i < 10; i++)
2153 c_put_str(TERM_YELLOW, quest_text[i], i + 8, 0);
2158 * @brief クエスト処理のメインルーチン / Request a quest from the Lord.
2161 static void castle_quest(void)
2163 QUEST_IDX q_index = 0;
2164 monster_race *r_ptr;
2171 /* Current quest of the building */
2172 q_index = current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].special;
2174 /* Is there a quest available at the building? */
2177 put_str(_("今のところクエストはありません。", "I don't have a quest for you at the moment."), 8, 0);
2181 q_ptr = &quest[q_index];
2183 /* Quest is completed */
2184 if (q_ptr->status == QUEST_STATUS_COMPLETED)
2186 /* Rewarded quest */
2187 q_ptr->status = QUEST_STATUS_REWARDED;
2189 get_questinfo(q_index, FALSE);
2191 reinit_wilderness = TRUE;
2194 else if (q_ptr->status == QUEST_STATUS_FAILED)
2196 get_questinfo(q_index, FALSE);
2198 /* Mark quest as done (but failed) */
2199 q_ptr->status = QUEST_STATUS_FAILED_DONE;
2201 reinit_wilderness = TRUE;
2203 /* Quest is still unfinished */
2204 else if (q_ptr->status == QUEST_STATUS_TAKEN)
2206 put_str(_("あなたは現在のクエストを終了させていません!", "You have not completed your current quest yet!"), 8, 0);
2207 put_str(_("CTRL-Qを使えばクエストの状態がチェックできます。", "Use CTRL-Q to check the status of your quest."), 9, 0);
2208 put_str(_("クエストを終わらせたら戻って来て下さい。", "Return when you have completed your quest."), 12, 0);
2211 else if (q_ptr->status == QUEST_STATUS_UNTAKEN)
2213 q_ptr->status = QUEST_STATUS_TAKEN;
2215 reinit_wilderness = TRUE;
2217 /* Assign a new quest */
2218 if (q_ptr->type == QUEST_TYPE_KILL_ANY_LEVEL)
2220 if (q_ptr->r_idx == 0)
2222 /* Random monster at least 5 - 10 levels out of deep */
2223 q_ptr->r_idx = get_mon_num(q_ptr->level + 4 + randint1(6));
2226 r_ptr = &r_info[q_ptr->r_idx];
2228 while ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->rarity != 1))
2230 q_ptr->r_idx = get_mon_num(q_ptr->level) + 4 + randint1(6);
2231 r_ptr = &r_info[q_ptr->r_idx];
2234 if (q_ptr->max_num == 0)
2236 /* Random monster number */
2237 if (randint1(10) > 7)
2240 q_ptr->max_num = randint1(3) + 1;
2244 name = (r_name + r_ptr->name);
2245 msg_format(_("クエスト: %sを %d体倒す", "Your quest: kill %d %s"), name,q_ptr->max_num);
2249 get_questinfo(q_index, TRUE);
2256 * @brief 町に関するヘルプを表示する / Display town history
2259 static void town_history(void)
2263 /* Peruse the building help file */
2264 (void)show_file(TRUE, _("jbldg.txt", "bldg.txt"), NULL, 0, 0);
2269 * @brief 攻撃時スレイによるダメージ期待値修正計算 / critical happens at i / 10000
2271 * @param mult スレイ倍率(掛け算部分)
2272 * @param div スレイ倍率(割り算部分)
2273 * @param force 理力特別計算フラグ
2276 static HIT_POINT calc_slaydam(HIT_POINT dam, int mult, int div, bool force)
2284 tmp += dam * 60 * 2;
2298 * @brief 攻撃時の期待値計算(スレイ→重量クリティカル→切れ味効果)
2300 * @param mult スレイ倍率(掛け算部分)
2301 * @param div スレイ倍率(割り算部分)
2302 * @param force 理力特別計算フラグ
2304 * @param plus 武器ダメージ修正
2305 * @param meichuu 命中値
2306 * @param dokubari 毒針処理か否か
2307 * @param vorpal_mult 切れ味倍率(掛け算部分)
2308 * @param vorpal_div 切れ味倍率(割り算部分)
2311 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)
2313 dam = calc_slaydam(dam, mult, div, force);
2314 dam = calc_expect_crit(weight, plus, dam, meichuu, dokubari);
2315 dam = calc_slaydam(dam, vorpal_mult, vorpal_div, FALSE);
2321 * @brief 武器の各条件毎のダメージ期待値を表示する。
2324 * @param mindice ダイス部分最小値
2325 * @param maxdice ダイス部分最大値
2327 * @param dam_bonus ダメージ修正値
2329 * @param color 条件内容の表示色
2331 * Display the damage figure of an object\n
2332 * (used by compare_weapon_aux)\n
2334 * Only accurate for the current weapon, because it includes\n
2335 * the current +dam of the player.\n
2338 static void show_weapon_dmg(int r, int c, int mindice, int maxdice, int blows, int dam_bonus, concptr attr, byte color)
2340 GAME_TEXT tmp_str[80];
2343 mindam = blows * (mindice + dam_bonus);
2344 maxdam = blows * (maxdice + dam_bonus);
2346 /* Print the intro text */
2347 c_put_str(color, attr, r, c);
2349 /* Calculate the min and max damage figures */
2350 sprintf(tmp_str, _("1ターン: %d-%d ダメージ", "Attack: %d-%d damage"), mindam, maxdam);
2352 /* Print the damage */
2353 put_str(tmp_str, r, c + 8);
2358 * @brief 武器一つ毎のダメージ情報を表示する。
2359 * @param o_ptr オブジェクトの構造体の参照ポインタ。
2360 * @param col 表示する行の上端
2363 * Show the damage figures for the various monster types\n
2365 * Only accurate for the current weapon, because it includes\n
2366 * the current number of blows for the player.\n
2369 static void compare_weapon_aux(object_type *o_ptr, int col, int r)
2371 BIT_FLAGS flgs[TR_FLAG_SIZE];
2372 int blow = p_ptr->num_blow[0];
2374 bool dokubari = FALSE;
2376 /* Effective dices */
2377 int eff_dd = o_ptr->dd + p_ptr->to_dd[0];
2378 int eff_ds = o_ptr->ds + p_ptr->to_ds[0];
2380 int mindice = eff_dd;
2381 int maxdice = eff_ds * eff_dd;
2384 int vorpal_mult = 1;
2386 int dmg_bonus = o_ptr->to_d + p_ptr->to_d[0];
2389 /* Get the flags of the weapon */
2390 object_flags(o_ptr, flgs);
2392 if((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) dokubari = TRUE;
2395 /* Show Critical Damage*/
2396 mindam = calc_expect_crit(o_ptr->weight, o_ptr->to_h, mindice, p_ptr->to_h[0], dokubari);
2397 maxdam = calc_expect_crit(o_ptr->weight, o_ptr->to_h, maxdice, p_ptr->to_h[0], dokubari);
2399 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("会心:", "Critical:"), TERM_L_RED);
2403 if ((have_flag(flgs, TR_VORPAL) || hex_spelling(HEX_RUNESWORD)))
2405 if((o_ptr->name1 == ART_VORPAL_BLADE) || (o_ptr->name1 == ART_CHAINSWORD))
2416 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);
2417 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);
2418 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("切れ味:", "Vorpal:") , TERM_L_RED);
2421 if ((p_ptr->pclass != CLASS_SAMURAI) && have_flag(flgs, TR_FORCE_WEAPON) && (p_ptr->csp > (o_ptr->dd * o_ptr->ds / 5)))
2425 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);
2426 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);
2427 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("理力:", "Force :"), TERM_L_BLUE);
2430 /* Print the relevant lines */
2431 if (have_flag(flgs, TR_KILL_ANIMAL))
2433 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);
2434 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);
2435 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("動物:", "Animals:"), TERM_YELLOW);
2437 else if (have_flag(flgs, TR_SLAY_ANIMAL))
2439 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);
2440 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);
2441 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("動物:", "Animals:"), TERM_YELLOW);
2443 if (have_flag(flgs, TR_KILL_EVIL))
2445 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);
2446 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);
2447 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("邪悪:", "Evil:"), TERM_YELLOW);
2449 else if (have_flag(flgs, TR_SLAY_EVIL))
2451 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);
2452 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);
2453 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("邪悪:", "Evil:"), TERM_YELLOW);
2455 if (have_flag(flgs, TR_KILL_HUMAN))
2457 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);
2458 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);
2459 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("人間:", "Human:"), TERM_YELLOW);
2461 else if (have_flag(flgs, TR_SLAY_HUMAN))
2463 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);
2464 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);
2465 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("人間:", "Human:"), TERM_YELLOW);
2467 if (have_flag(flgs, TR_KILL_UNDEAD))
2469 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);
2470 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);
2471 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("不死:", "Undead:"), TERM_YELLOW);
2473 else if (have_flag(flgs, TR_SLAY_UNDEAD))
2475 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);
2476 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);
2477 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("不死:", "Undead:"), TERM_YELLOW);
2479 if (have_flag(flgs, TR_KILL_DEMON))
2481 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);
2482 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);
2483 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("悪魔:", "Demons:") , TERM_YELLOW);
2485 else if (have_flag(flgs, TR_SLAY_DEMON))
2487 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);
2488 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);
2489 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("悪魔:", "Demons:") , TERM_YELLOW);
2491 if (have_flag(flgs, TR_KILL_ORC))
2493 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);
2494 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);
2495 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("オーク:", "Orcs:"), TERM_YELLOW);
2497 else if (have_flag(flgs, TR_SLAY_ORC))
2499 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);
2500 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);
2501 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("オーク:", "Orcs:"), TERM_YELLOW);
2503 if (have_flag(flgs, TR_KILL_TROLL))
2505 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);
2506 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);
2507 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("トロル:", "Trolls:") , TERM_YELLOW);
2509 else if (have_flag(flgs, TR_SLAY_TROLL))
2511 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);
2512 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);
2513 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("トロル:", "Trolls:") , TERM_YELLOW);
2515 if (have_flag(flgs, TR_KILL_GIANT))
2517 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);
2518 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);
2519 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("巨人:", "Giants:"), TERM_YELLOW);
2521 else if (have_flag(flgs, TR_SLAY_GIANT))
2523 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);
2524 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);
2525 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("巨人:", "Giants:"), TERM_YELLOW);
2527 if (have_flag(flgs, TR_KILL_DRAGON))
2529 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);
2530 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);
2531 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("竜:", "Dragons:"), TERM_YELLOW);
2533 else if (have_flag(flgs, TR_SLAY_DRAGON))
2535 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);
2536 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);
2537 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("竜:", "Dragons:"), TERM_YELLOW);
2539 if (have_flag(flgs, TR_BRAND_ACID))
2541 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);
2542 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);
2543 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("酸属性:", "Acid:"), TERM_RED);
2545 if (have_flag(flgs, TR_BRAND_ELEC))
2547 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);
2548 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);
2549 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("電属性:", "Elec:"), TERM_RED);
2551 if (have_flag(flgs, TR_BRAND_FIRE))
2553 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);
2554 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);
2555 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("炎属性:", "Fire:"), TERM_RED);
2557 if (have_flag(flgs, TR_BRAND_COLD))
2559 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);
2560 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);
2561 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("冷属性:", "Cold:"), TERM_RED);
2563 if (have_flag(flgs, TR_BRAND_POIS))
2565 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);
2566 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);
2567 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("毒属性:", "Poison:"), TERM_RED);
2572 * @brief 武器匠における武器一つ毎の完全情報を表示する。
2573 * @param o_ptr オブジェクトの構造体の参照ポインタ。
2574 * @param row 表示する列の左端
2575 * @param col 表示する行の上端
2577 * Displays all info about a weapon
2579 * Only accurate for the current weapon, because it includes
2580 * various info about the player's +to_dam and number of blows.
2583 static void list_weapon(object_type *o_ptr, TERM_LEN row, TERM_LEN col)
2585 GAME_TEXT o_name[MAX_NLEN];
2586 GAME_TEXT tmp_str[80];
2588 DICE_NUMBER eff_dd = o_ptr->dd + p_ptr->to_dd[0];
2589 DICE_SID eff_ds = o_ptr->ds + p_ptr->to_ds[0];
2590 HIT_RELIABILITY reli = p_ptr->skill_thn + (p_ptr->to_h[0] + o_ptr->to_h) * BTH_PLUS_ADJ;
2592 /* Print the weapon name */
2593 object_desc(o_name, o_ptr, OD_NAME_ONLY);
2594 c_put_str(TERM_YELLOW, o_name, row, col);
2596 /* Print the player's number of blows */
2597 sprintf(tmp_str, _("攻撃回数: %d", "Number of Blows: %d"), p_ptr->num_blow[0]);
2598 put_str(tmp_str, row+1, col);
2600 /* Print to_hit and to_dam of the weapon */
2601 sprintf(tmp_str, _("命中率: 0 50 100 150 200 (敵のAC)", "To Hit: 0 50 100 150 200 (AC)"));
2602 put_str(tmp_str, row+2, col);
2604 /* Print the weapons base damage dice */
2605 sprintf(tmp_str, " %2d %2d %2d %2d %2d (%%)",
2606 (int)hit_chance(reli, 0),
2607 (int)hit_chance(reli, 50),
2608 (int)hit_chance(reli, 100),
2609 (int)hit_chance(reli, 150),
2610 (int)hit_chance(reli, 200));
2611 put_str(tmp_str, row+3, col);
2612 c_put_str(TERM_YELLOW, _("可能なダメージ:", "Possible Damage:"), row+5, col);
2614 /* Damage for one blow (if it hits) */
2615 sprintf(tmp_str, _("攻撃一回につき %d-%d", "One Strike: %d-%d damage"),
2616 (int)(eff_dd + o_ptr->to_d + p_ptr->to_d[0]),
2617 (int)(eff_ds * eff_dd + o_ptr->to_d + p_ptr->to_d[0]));
2618 put_str(tmp_str, row+6, col+1);
2620 /* Damage for the complete attack (if all blows hit) */
2621 sprintf(tmp_str, _("1ターンにつき %d-%d", "One Attack: %d-%d damage"),
2622 (int)(p_ptr->num_blow[0] * (eff_dd + o_ptr->to_d + p_ptr->to_d[0])),
2623 (int)(p_ptr->num_blow[0] * (eff_ds * eff_dd + o_ptr->to_d + p_ptr->to_d[0])));
2624 put_str(tmp_str, row+7, col+1);
2628 * @brief 武器匠鑑定1回分(オブジェクト2種)の処理。/ Compare weapons
2630 * Copies the weapons to compare into the weapon-slot and\n
2631 * compares the values for both weapons.\n
2632 * 武器1つだけで比較をしないなら費用は半額になる。
2633 * @param bcost 基本鑑定費用
2634 * @return 最終的にかかった費用
2636 static PRICE compare_weapons(PRICE bcost)
2639 OBJECT_IDX item, item2;
2640 object_type *o_ptr[2];
2641 object_type orig_weapon;
2645 TERM_LEN wid = 38, mgn = 2;
2646 bool old_character_xtra = current_world_ptr->character_xtra;
2649 PRICE cost = 0; /* First time no price */
2654 /* Store copy of original wielded weapon */
2655 i_ptr = &p_ptr->inventory_list[INVEN_RARM];
2656 object_copy(&orig_weapon, i_ptr);
2658 item_tester_hook = item_tester_hook_orthodox_melee_weapons;
2660 /* Get the first weapon */
2661 q = _("第一の武器は?", "What is your first weapon? ");
2662 s = _("比べるものがありません。", "You have nothing to compare.");
2664 o_ptr[0] = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | IGNORE_BOTHHAND_SLOT), 0);
2678 /* Only compare melee weapons */
2679 item_tester_hook = item_tester_hook_orthodox_melee_weapons;
2681 /* Hack -- prevent "icky" message */
2682 current_world_ptr->character_xtra = TRUE;
2684 /* Diaplay selected weapon's infomation */
2685 for (i = 0; i < n; i++)
2687 int col = (wid * i + mgn);
2689 /* Copy i-th weapon into the weapon slot (if it's not already there) */
2690 if (o_ptr[i] != i_ptr) object_copy(i_ptr, o_ptr[i]);
2692 p_ptr->update |= PU_BONUS;
2695 /* List the new values */
2696 list_weapon(o_ptr[i], row, col);
2697 compare_weapon_aux(o_ptr[i], col, row + 8);
2699 /* Copy back the original weapon into the weapon slot */
2700 object_copy(i_ptr, &orig_weapon);
2703 /* Reset the values for the old weapon */
2704 p_ptr->update |= PU_BONUS;
2707 current_world_ptr->character_xtra = old_character_xtra;
2710 put_str(format("[ 比較対象: 's'で変更 ($%d) ]", cost), 1, (wid + mgn));
2711 put_str("(一番高いダメージが適用されます。複数の倍打効果は足し算されません。)", row + 4, 0);
2712 prt("現在の技量から判断すると、あなたの武器は以下のような威力を発揮します:", 0, 0);
2714 put_str(format("[ 's' Select secondary weapon($%d) ]", cost), row + 1, (wid * i + mgn));
2715 put_str("(Only highest damage applies per monster. Special damage not cumulative.)", row + 4, 0);
2716 prt("Based on your current abilities, here is what your weapons will do", 0, 0);
2724 if (total + cost > p_ptr->au)
2726 msg_print(_("お金が足りません!", "You don't have enough money!"));
2731 q = _("第二の武器は?", "What is your second weapon? ");
2732 s = _("比べるものがありません。", "You have nothing to compare.");
2734 /* Get the second weapon */
2735 o_ptr[1] = choose_object(&item2, q, s, (USE_EQUIP | USE_INVEN | IGNORE_BOTHHAND_SLOT), 0);
2736 if (!o_ptr[1]) continue;
2754 * @brief ACから回避率、ダメージ減少率を計算し表示する。 / Evaluate AC
2756 * Calculate and display the dodge-rate and the protection-rate
2758 * @param iAC プレイヤーのAC。
2759 * @return 常にTRUEを返す。
2761 static bool eval_ac(ARMOUR_CLASS iAC)
2765 "ダメージ軽減率とは、敵の攻撃が当たった時そのダメージを\n"
2766 "何パーセント軽減するかを示します。\n"
2767 "ダメージ軽減は通常の直接攻撃(種類が「攻撃する」と「粉砕する」の物)\n"
2768 "に対してのみ効果があります。\n \n"
2769 "敵のレベルとは、その敵が通常何階に現れるかを示します。\n \n"
2770 "回避率は敵の直接攻撃を何パーセントの確率で避けるかを示し、\n"
2771 "敵のレベルとあなたのACによって決定されます。\n \n"
2772 "ダメージ期待値とは、敵の100ポイントの通常攻撃に対し、\n"
2773 "回避率とダメージ軽減率を考慮したダメージの期待値を示します。\n";
2776 "'Protection Rate' means how much damage is reduced by your armor.\n"
2777 "Note that the Protection rate is effective only against normal "
2778 "'attack' and 'shatter' type melee attacks, "
2779 "and has no effect against any other types such as 'poison'.\n \n"
2780 "'Dodge Rate' indicates the success rate on dodging the "
2781 "monster's melee attacks. "
2782 "It is depend on the level of the monster and your AC.\n \n"
2783 "'Average Damage' indicates the expected amount of damage "
2784 "when you are attacked by normal melee attacks with power=100.";
2788 TERM_LEN col, row = 2;
2790 char buf[80*20], *t;
2792 /* AC lower than zero has no effect */
2793 if (iAC < 0) iAC = 0;
2796 protection = 100 * MIN(iAC, 150) / 250;
2801 put_str(format(_("あなたの現在のAC: %3d", "Your current AC : %3d"), iAC), row++, 0);
2802 put_str(format(_("ダメージ軽減率 : %3d%%", "Protection rate : %3d%%"), protection), row++, 0);
2805 put_str(_("敵のレベル :", "Level of Monster:"), row + 0, 0);
2806 put_str(_("回避率 :", "Dodge Rate :"), row + 1, 0);
2807 put_str(_("ダメージ期待値 :", "Average Damage :"), row + 2, 0);
2809 for (col = 17 + 1, lvl = 0; lvl <= 100; lvl += 10, col += 5)
2811 int quality = 60 + lvl * 3; /* attack quality with power 60 */
2812 int dodge; /* 回避率(%) */
2813 int average; /* ダメージ期待値 */
2815 put_str(format("%3d", lvl), row + 0, col);
2818 dodge = 5 + (MIN(100, 100 * (iAC * 3 / 4) / quality) * 9 + 5) / 10;
2819 put_str(format("%3d%%", dodge), row + 1, col);
2821 /* 100点の攻撃に対してのダメージ期待値を計算 */
2822 average = (100 - dodge) * (100 - protection) / 100;
2823 put_str(format("%3d", average), row + 2, col);
2827 roff_to_buf(memo, 70, buf, sizeof(buf));
2828 for (t = buf; t[0]; t += strlen(t) + 1)
2829 put_str(t, (row++) + 4, 4);
2831 prt(_("現在のあなたの装備からすると、あなたの防御力はこれくらいです:", "Defense abilities from your current Armor Class are evaluated below."), 0, 0);
2843 * @brief 修復材料のオブジェクトから修復対象に特性を移植する。
2844 * @param to_ptr 修復対象オブジェクトの構造体の参照ポインタ。
2845 * @param from_ptr 修復材料オブジェクトの構造体の参照ポインタ。
2846 * @return 修復対象になるならTRUEを返す。
2848 static void give_one_ability_of_object(object_type *to_ptr, object_type *from_ptr)
2851 int cand[TR_FLAG_MAX];
2852 BIT_FLAGS to_flgs[TR_FLAG_SIZE];
2853 BIT_FLAGS from_flgs[TR_FLAG_SIZE];
2855 object_flags(to_ptr, to_flgs);
2856 object_flags(from_ptr, from_flgs);
2858 for (i = 0; i < TR_FLAG_MAX; i++)
2862 case TR_IGNORE_ACID:
2863 case TR_IGNORE_ELEC:
2864 case TR_IGNORE_FIRE:
2865 case TR_IGNORE_COLD:
2874 case TR_FIXED_FLAVOR:
2877 if (have_flag(from_flgs, i) && !have_flag(to_flgs, i))
2879 if (!(is_pval_flag(i) && (from_ptr->pval < 1))) cand[n++] = i;
2887 int tr_idx = cand[randint0(n)];
2888 add_flag(to_ptr->art_flags, tr_idx);
2889 if (is_pval_flag(tr_idx)) to_ptr->pval = MAX(to_ptr->pval, 1);
2890 bmax = MIN(3, MAX(1, 40 / (to_ptr->dd * to_ptr->ds)));
2891 if (tr_idx == TR_BLOWS) to_ptr->pval = MIN(to_ptr->pval, bmax);
2892 if (tr_idx == TR_SPEED) to_ptr->pval = MIN(to_ptr->pval, 4);
2899 * @brief アイテム修復処理のメインルーチン / Repair broken weapon
2900 * @param bcost 基本修復費用
2903 static PRICE repair_broken_weapon_aux(PRICE bcost)
2906 OBJECT_IDX item, mater;
2907 object_type *o_ptr, *mo_ptr; /* broken weapon and material weapon */
2909 int i, dd_bonus, ds_bonus;
2910 KIND_OBJECT_IDX k_idx;
2911 char basenm[MAX_NLEN];
2916 prt(_("修復には材料となるもう1つの武器が必要です。", "Hand one material weapon to repair a broken weapon."), row, 2);
2917 prt(_("材料に使用した武器はなくなります!", "The material weapon will disappear after repairing!!"), row+1, 2);
2919 q = _("どの折れた武器を修復しますか?", "Repair which broken weapon? ");
2920 s = _("修復できる折れた武器がありません。", "You have no broken weapon to repair.");
2922 /* Only forge broken weapons */
2923 item_tester_hook = item_tester_hook_broken_weapon;
2925 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_EQUIP), 0);
2926 if (!o_ptr) return (0);
2928 /* It is worthless */
2929 if (!object_is_ego(o_ptr) && !object_is_artifact(o_ptr))
2931 msg_format(_("それは直してもしょうがないぜ。", "It is worthless to repair."));
2935 /* They are too many */
2936 if (o_ptr->number > 1)
2938 msg_format(_("一度に複数を修復することはできません!", "They are too many to repair at once!"));
2942 /* Display item name */
2943 object_desc(basenm, o_ptr, OD_NAME_ONLY);
2944 prt(format(_("修復する武器 : %s", "Repairing: %s"), basenm), row+3, 2);
2946 q = _("材料となる武器は?", "Which weapon for material? ");
2947 s = _("材料となる武器がありません。", "You have no material to repair.");
2949 /* Only forge broken weapons */
2950 item_tester_hook = item_tester_hook_orthodox_melee_weapons;
2952 mo_ptr = choose_object(&mater, q, s, (USE_INVEN | USE_EQUIP), 0);
2953 if (!mo_ptr) return (0);
2956 msg_print(_("クラインの壷じゃない!", "This is not a klein bottle!"));
2960 /* Display item name */
2961 object_desc(basenm, mo_ptr, OD_NAME_ONLY);
2962 prt(format(_("材料とする武器: %s", "Material : %s"), basenm), row+4, 2);
2964 /* Get the value of one of the items (except curses) */
2965 cost = bcost + object_value_real(o_ptr) * 2;
2967 if (!get_check(format(_("$%dかかりますがよろしいですか? ", "Costs %d gold, okay? "), cost))) return (0);
2969 /* Check if the player has enough money */
2970 if (p_ptr->au < cost)
2972 object_desc(basenm, o_ptr, OD_NAME_ONLY);
2973 msg_format(_("%sを修復するだけのゴールドがありません!", "You do not have the gold to repair %s!"), basenm);
2978 p_ptr->total_weight -= o_ptr->weight;
2980 if (o_ptr->sval == SV_BROKEN_DAGGER)
2985 /* Suppress compiler warning */
2988 for (j = 1; j < max_k_idx; j++)
2990 object_kind *k_aux_ptr = &k_info[j];
2992 if (k_aux_ptr->tval != TV_SWORD) continue;
2993 if ((k_aux_ptr->sval == SV_BROKEN_DAGGER) ||
2994 (k_aux_ptr->sval == SV_BROKEN_SWORD) ||
2995 (k_aux_ptr->sval == SV_DOKUBARI)) continue;
2996 if (k_aux_ptr->weight > 99) continue;
3005 else /* TV_BROKEN_SWORD */
3007 /* Repair to a sword or sometimes material's type weapon */
3008 OBJECT_TYPE_VALUE tval = (one_in_(5) ? mo_ptr->tval : TV_SWORD);
3012 object_kind *ck_ptr;
3014 k_idx = lookup_kind(tval, SV_ANY);
3015 ck_ptr = &k_info[k_idx];
3017 if (tval == TV_SWORD)
3019 if ((ck_ptr->sval == SV_BROKEN_DAGGER) ||
3020 (ck_ptr->sval == SV_BROKEN_SWORD) ||
3021 (ck_ptr->sval == SV_DIAMOND_EDGE) ||
3022 (ck_ptr->sval == SV_DOKUBARI)) continue;
3024 if (tval == TV_POLEARM)
3026 if ((ck_ptr->sval == SV_DEATH_SCYTHE) ||
3027 (ck_ptr->sval == SV_TSURIZAO)) continue;
3029 if (tval == TV_HAFTED)
3031 if ((ck_ptr->sval == SV_GROND) ||
3032 (ck_ptr->sval == SV_WIZSTAFF) ||
3033 (ck_ptr->sval == SV_NAMAKE_HAMMER)) continue;
3040 /* Calculate dice bonuses */
3041 dd_bonus = o_ptr->dd - k_info[o_ptr->k_idx].dd;
3042 ds_bonus = o_ptr->ds - k_info[o_ptr->k_idx].ds;
3043 dd_bonus += mo_ptr->dd - k_info[mo_ptr->k_idx].dd;
3044 ds_bonus += mo_ptr->ds - k_info[mo_ptr->k_idx].ds;
3046 /* Change base object */
3047 k_ptr = &k_info[k_idx];
3048 o_ptr->k_idx = k_idx;
3049 o_ptr->weight = k_ptr->weight;
3050 o_ptr->tval = k_ptr->tval;
3051 o_ptr->sval = k_ptr->sval;
3052 o_ptr->dd = k_ptr->dd;
3053 o_ptr->ds = k_ptr->ds;
3055 /* Copy base object's ability */
3056 for (i = 0; i < TR_FLAG_SIZE; i++) o_ptr->art_flags[i] |= k_ptr->flags[i];
3057 if (k_ptr->pval) o_ptr->pval = MAX(o_ptr->pval, randint1(k_ptr->pval));
3058 if (have_flag(k_ptr->flags, TR_ACTIVATE)) o_ptr->xtra2 = (byte_hack)k_ptr->act_idx;
3064 for (i = 1; i < dd_bonus; i++)
3066 if (one_in_(o_ptr->dd + i)) o_ptr->dd++;
3072 for (i = 1; i < ds_bonus; i++)
3074 if (one_in_(o_ptr->ds + i)) o_ptr->ds++;
3078 if (have_flag(k_ptr->flags, TR_BLOWS))
3080 int bmax = MIN(3, MAX(1, 40 / (o_ptr->dd * o_ptr->ds)));
3081 o_ptr->pval = MIN(o_ptr->pval, bmax);
3084 /* Add one random ability from material weapon */
3085 give_one_ability_of_object(o_ptr, mo_ptr);
3087 /* Add to-dam, to-hit and to-ac from material weapon */
3088 o_ptr->to_d += MAX(0, (mo_ptr->to_d / 3));
3089 o_ptr->to_h += MAX(0, (mo_ptr->to_h / 3));
3090 o_ptr->to_a += MAX(0, (mo_ptr->to_a));
3092 if ((o_ptr->name1 == ART_NARSIL) ||
3093 (object_is_random_artifact(o_ptr) && one_in_(1)) ||
3094 (object_is_ego(o_ptr) && one_in_(7)))
3097 if (object_is_ego(o_ptr))
3099 add_flag(o_ptr->art_flags, TR_IGNORE_FIRE);
3100 add_flag(o_ptr->art_flags, TR_IGNORE_ACID);
3103 /* Add one random ability from material weapon */
3104 give_one_ability_of_object(o_ptr, mo_ptr);
3106 /* Add one random activation */
3107 if (!activation_index(o_ptr)) one_activation(o_ptr);
3110 if (o_ptr->name1 == ART_NARSIL)
3112 one_high_resistance(o_ptr);
3116 msg_print(_("これはかなりの業物だったようだ。", "This blade seems to be exceptionally."));
3119 object_desc(basenm, o_ptr, OD_NAME_ONLY);
3121 msg_format("$%dで%sに修復しました。", cost, basenm);
3123 msg_format("Repaired into %s for %d gold.", basenm, cost);
3127 /* Remove BROKEN flag */
3128 o_ptr->ident &= ~(IDENT_BROKEN);
3130 /* Add repaired flag */
3131 o_ptr->discount = 99;
3133 p_ptr->total_weight += o_ptr->weight;
3134 calc_android_exp(p_ptr);
3136 /* Decrease material object */
3137 inven_item_increase(mater, -1);
3138 inven_item_optimize(mater);
3141 p_ptr->update |= PU_BONUS;
3144 /* Something happened */
3149 * @brief アイテム修復処理の過渡ルーチン / Repair broken weapon
3150 * @param bcost 基本鑑定費用
3153 static int repair_broken_weapon(PRICE bcost)
3157 cost = repair_broken_weapon_aux(bcost);
3164 * @brief アイテムの強化を行う。 / Enchant item
3165 * @param cost 1回毎の費用
3166 * @param to_hit 命中をアップさせる量
3167 * @param to_dam ダメージをアップさせる量
3168 * @param to_ac ACをアップさせる量
3169 * @return 実際に行ったらTRUE
3171 static bool enchant_item(PRICE cost, HIT_PROB to_hit, HIT_POINT to_dam, ARMOUR_CLASS to_ac)
3178 int maxenchant = (p_ptr->lev / 5);
3179 char tmp_str[MAX_NLEN];
3182 prt(format(_("現在のあなたの技量だと、+%d まで改良できます。", " Based on your skill, we can improve up to +%d."), maxenchant), 5, 0);
3183 prt(format(_(" 改良の料金は一個につき$%d です。", " The price for the service is %d gold per item."), cost), 7, 0);
3185 q = _("どのアイテムを改良しますか?", "Improve which item? ");
3186 s = _("改良できるものがありません。", "You have nothing to improve.");
3188 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_EQUIP | IGNORE_BOTHHAND_SLOT), item_tester_tval);
3189 if (!o_ptr) return (FALSE);
3191 /* Check if the player has enough money */
3192 if (p_ptr->au < (cost * o_ptr->number))
3194 object_desc(tmp_str, o_ptr, OD_NAME_ONLY);
3195 msg_format(_("%sを改良するだけのゴールドがありません!", "You do not have the gold to improve %s!"), tmp_str);
3199 /* Enchant to hit */
3200 for (i = 0; i < to_hit; i++)
3202 if (o_ptr->to_h < maxenchant)
3204 if (enchant(o_ptr, 1, (ENCH_TOHIT | ENCH_FORCE)))
3212 /* Enchant to damage */
3213 for (i = 0; i < to_dam; i++)
3215 if (o_ptr->to_d < maxenchant)
3217 if (enchant(o_ptr, 1, (ENCH_TODAM | ENCH_FORCE)))
3226 for (i = 0; i < to_ac; i++)
3228 if (o_ptr->to_a < maxenchant)
3230 if (enchant(o_ptr, 1, (ENCH_TOAC | ENCH_FORCE)))
3241 if (flush_failure) flush();
3242 msg_print(_("改良に失敗した。", "The improvement failed."));
3247 object_desc(tmp_str, o_ptr, OD_NAME_AND_ENCHANT);
3249 msg_format("$%dで%sに改良しました。", cost * o_ptr->number, tmp_str);
3251 msg_format("Improved into %s for %d gold.", tmp_str, cost * o_ptr->number);
3254 /* Charge the money */
3255 p_ptr->au -= (cost * o_ptr->number);
3257 if (item >= INVEN_RARM) calc_android_exp(p_ptr);
3259 /* Something happened */
3266 * @brief 魔道具の使用回数を回復させる施設のメインルーチン / Recharge rods, wands and staves
3268 * The player can select the number of charges to add\n
3269 * (up to a limit), and the recharge never fails.\n
3271 * The cost for rods depends on the level of the rod. The prices\n
3272 * for recharging wands and staves are dependent on the cost of\n
3276 static void building_recharge(void)
3284 PARAMETER_VALUE charges;
3286 char tmp_str[MAX_NLEN];
3290 /* Display some info */
3292 prt(_(" 再充填の費用はアイテムの種類によります。", " The prices of recharge depend on the type."), 6, 0);
3295 /* Only accept legal items */
3296 item_tester_hook = item_tester_hook_recharge;
3298 q = _("どのアイテムに魔力を充填しますか? ", "Recharge which item? ");
3299 s = _("魔力を充填すべきアイテムがない。", "You have nothing to recharge.");
3301 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR), 0);
3304 k_ptr = &k_info[o_ptr->k_idx];
3307 * We don't want to give the player free info about
3308 * the level of the item or the number of charges.
3310 /* The item must be "known" */
3311 if (!object_is_known(o_ptr))
3313 msg_format(_("充填する前に鑑定されている必要があります!", "The item must be identified first!"));
3316 if ((p_ptr->au >= 50) &&
3317 get_check(_("$50で鑑定しますか? ", "Identify for 50 gold? ")))
3321 identify_item(o_ptr);
3322 object_desc(tmp_str, o_ptr, 0);
3323 msg_format(_("%s です。", "You have: %s."), tmp_str);
3325 /* Auto-inscription */
3326 autopick_alter_item(item, FALSE);
3328 /* Update the gold display */
3329 building_prt_gold();
3337 /* Extract the object "level" */
3338 lev = k_info[o_ptr->k_idx].level;
3340 /* Price for a rod */
3341 if (o_ptr->tval == TV_ROD)
3343 if (o_ptr->timeout > 0)
3345 /* Fully recharge */
3346 price = (lev * 50 * o_ptr->timeout) / k_ptr->pval;
3350 /* No recharge necessary */
3352 msg_format(_("それは再充填する必要はありません。", "That doesn't need to be recharged."));
3356 else if (o_ptr->tval == TV_STAFF)
3358 /* Price per charge ( = double the price paid by shopkeepers for the charge) */
3359 price = (k_info[o_ptr->k_idx].cost / 10) * o_ptr->number;
3361 /* Pay at least 10 gold per charge */
3362 price = MAX(10, price);
3366 /* Price per charge ( = double the price paid by shopkeepers for the charge) */
3367 price = (k_info[o_ptr->k_idx].cost / 10);
3369 /* Pay at least 10 gold per charge */
3370 price = MAX(10, price);
3373 /* Limit the number of charges for wands and staffs */
3374 if (o_ptr->tval == TV_WAND
3375 && (o_ptr->pval / o_ptr->number >= k_ptr->pval))
3377 if (o_ptr->number > 1)
3379 msg_print(_("この魔法棒はもう充分に充填されています。", "These wands are already fully charged."));
3383 msg_print(_("この魔法棒はもう充分に充填されています。", "This wand is already fully charged."));
3387 else if (o_ptr->tval == TV_STAFF && o_ptr->pval >= k_ptr->pval)
3389 if (o_ptr->number > 1)
3391 msg_print(_("この杖はもう充分に充填されています。", "These staffs are already fully charged."));
3395 msg_print(_("この杖はもう充分に充填されています。", "This staff is already fully charged."));
3400 /* Check if the player has enough money */
3401 if (p_ptr->au < price)
3403 object_desc(tmp_str, o_ptr, OD_NAME_ONLY);
3405 msg_format("%sを再充填するには$%d 必要です!", tmp_str,price );
3407 msg_format("You need %d gold to recharge %s!", price, tmp_str);
3413 if (o_ptr->tval == TV_ROD)
3416 if (get_check(format("そのロッドを$%d で再充填しますか?", price)))
3418 if (get_check(format("Recharge the %s for %d gold? ",
3419 ((o_ptr->number > 1) ? "rods" : "rod"), price)))
3423 /* Recharge fully */
3433 if (o_ptr->tval == TV_STAFF)
3434 max_charges = k_ptr->pval - o_ptr->pval;
3436 max_charges = o_ptr->number * k_ptr->pval - o_ptr->pval;
3438 /* Get the quantity for staves and wands */
3439 charges = (PARAMETER_VALUE)get_quantity(format(_("一回分$%d で何回分充填しますか?", "Add how many charges for %d gold? "), price),
3440 MIN(p_ptr->au / price, max_charges));
3443 if (charges < 1) return;
3445 /* Get the new price */
3449 o_ptr->pval += charges;
3451 /* We no longer think the item is empty */
3452 o_ptr->ident &= ~(IDENT_EMPTY);
3456 object_desc(tmp_str, o_ptr, 0);
3458 msg_format("%sを$%d で再充填しました。", tmp_str, price);
3460 msg_format("%^s %s recharged for %d gold.", tmp_str, ((o_ptr->number > 1) ? "were" : "was"), price);
3462 p_ptr->update |= (PU_COMBINE | PU_REORDER);
3464 p_ptr->window |= (PW_INVEN);
3475 * @brief 魔道具の使用回数を回復させる施設の一括処理向けサブルーチン / Recharge rods, wands and staves
3477 * The player can select the number of charges to add\n
3478 * (up to a limit), and the recharge never fails.\n
3480 * The cost for rods depends on the level of the rod. The prices\n
3481 * for recharging wands and staves are dependent on the cost of\n
3485 static void building_recharge_all(void)
3492 PRICE total_cost = 0;
3495 /* Display some info */
3498 prt(_(" 再充填の費用はアイテムの種類によります。", " The prices of recharge depend on the type."), 6, 0);
3500 /* Calculate cost */
3501 for ( i = 0; i < INVEN_PACK; i++)
3503 o_ptr = &p_ptr->inventory_list[i];
3505 /* skip non magic device */
3506 if (o_ptr->tval < TV_STAFF || o_ptr->tval > TV_ROD) continue;
3508 /* need identified */
3509 if (!object_is_known(o_ptr)) total_cost += 50;
3511 /* Extract the object "level" */
3512 lev = k_info[o_ptr->k_idx].level;
3514 k_ptr = &k_info[o_ptr->k_idx];
3516 switch (o_ptr->tval)
3519 price = (lev * 50 * o_ptr->timeout) / k_ptr->pval;
3523 /* Price per charge ( = double the price paid by shopkeepers for the charge) */
3524 price = (k_info[o_ptr->k_idx].cost / 10) * o_ptr->number;
3526 /* Pay at least 10 gold per charge */
3527 price = MAX(10, price);
3530 price = (k_ptr->pval - o_ptr->pval) * price;
3534 /* Price per charge ( = double the price paid by shopkeepers for the charge) */
3535 price = (k_info[o_ptr->k_idx].cost / 10);
3537 /* Pay at least 10 gold per charge */
3538 price = MAX(10, price);
3541 price = (o_ptr->number * k_ptr->pval - o_ptr->pval) * price;
3545 /* if price <= 0 then item have enough charge */
3546 if (price > 0) total_cost += price;
3551 msg_print(_("充填する必要はありません。", "No need to recharge."));
3556 /* Check if the player has enough money */
3557 if (p_ptr->au < total_cost)
3559 msg_format(_("すべてのアイテムを再充填するには$%d 必要です!", "You need %d gold to recharge all items!"), total_cost );
3563 if (!get_check(format(_("すべてのアイテムを $%d で再充填しますか?", "Recharge all items for %d gold? "), total_cost))) return;
3565 for (i = 0; i < INVEN_PACK; i++)
3567 o_ptr = &p_ptr->inventory_list[i];
3568 k_ptr = &k_info[o_ptr->k_idx];
3570 /* skip non magic device */
3571 if (o_ptr->tval < TV_STAFF || o_ptr->tval > TV_ROD) continue;
3573 if (!object_is_known(o_ptr))
3575 identify_item(o_ptr);
3577 /* Auto-inscription */
3578 autopick_alter_item(i, FALSE);
3582 switch (o_ptr->tval)
3588 if (o_ptr->pval < k_ptr->pval) o_ptr->pval = k_ptr->pval;
3589 /* We no longer think the item is empty */
3590 o_ptr->ident &= ~(IDENT_EMPTY);
3593 if (o_ptr->pval < o_ptr->number * k_ptr->pval)
3594 o_ptr->pval = o_ptr->number * k_ptr->pval;
3595 /* We no longer think the item is empty */
3596 o_ptr->ident &= ~(IDENT_EMPTY);
3602 msg_format(_("$%d で再充填しました。", "You pay %d gold."), total_cost);
3604 p_ptr->update |= (PU_COMBINE | PU_REORDER);
3606 p_ptr->window |= (PW_INVEN);
3609 p_ptr->au -= total_cost;
3616 * @brief 施設でモンスターの情報を知るメインルーチン / research_mon -KMW-
3617 * @return 常にTRUEを返す。
3618 * @todo 返り値が意味不明なので直した方が良いかもしれない。
3620 static bool research_mon(void)
3628 bool recall = FALSE;
3632 /* XTRA HACK WHATSEARCH */
3638 /* XTRA HACK REMEMBER_IDX */
3639 static int old_sym = '\0';
3640 static IDX old_i = 0;
3644 /* Get a character, or abort */
3645 if (!get_com(_("モンスターの文字を入力して下さい(記号 or ^A全,^Uユ,^N非ユ,^M名前):",
3646 "Enter character to be identified(^A:All,^U:Uniqs,^N:Non uniqs,^M:Name): "), &sym, FALSE))
3654 /* Find that character info, and describe it */
3655 for (i = 0; ident_info[i]; ++i)
3657 if (sym == ident_info[i][0]) break;
3660 /* XTRA HACK WHATSEARCH */
3661 if (sym == KTRL('A'))
3664 strcpy(buf, _("全モンスターのリスト", "Full monster list."));
3666 else if (sym == KTRL('U'))
3669 strcpy(buf, _("ユニーク・モンスターのリスト", "Unique monster list."));
3671 else if (sym == KTRL('N'))
3674 strcpy(buf, _("ユニーク外モンスターのリスト", "Non-unique monster list."));
3676 else if (sym == KTRL('M'))
3679 if (!get_string(_("名前(英語の場合小文字で可)", "Enter name:"),temp, 70))
3686 sprintf(buf, _("名前:%sにマッチ", "Monsters with a name \"%s\""),temp);
3688 else if (ident_info[i])
3690 sprintf(buf, "%c - %s.", sym, ident_info[i] + 2);
3694 sprintf(buf, "%c - %s", sym, _("無効な文字", "Unknown Symbol"));
3697 /* Display the result */
3700 /* Allocate the "who" array */
3701 C_MAKE(who, max_r_idx, MONRACE_IDX);
3703 /* Collect matching monsters */
3704 for (n = 0, i = 1; i < max_r_idx; i++)
3706 monster_race *r_ptr = &r_info[i];
3709 if (!r_ptr->name) continue;
3711 /* XTRA HACK WHATSEARCH */
3712 /* Require non-unique monsters if needed */
3713 if (norm && (r_ptr->flags1 & (RF1_UNIQUE))) continue;
3715 /* Require unique monsters if needed */
3716 if (uniq && !(r_ptr->flags1 & (RF1_UNIQUE))) continue;
3724 for (xx = 0; temp[xx] && xx < 80; xx++)
3727 if (iskanji(temp[xx]))
3733 if (isupper(temp[xx])) temp[xx] = (char)tolower(temp[xx]);
3737 strcpy(temp2, r_name + r_ptr->E_name);
3739 strcpy(temp2, r_name + r_ptr->name);
3741 for (xx = 0; temp2[xx] && xx < 80; xx++)
3742 if (isupper(temp2[xx])) temp2[xx] = (char)tolower(temp2[xx]);
3745 if (my_strstr(temp2, temp) || my_strstr(r_name + r_ptr->name, temp))
3747 if (my_strstr(temp2, temp))
3751 else if (all || (r_ptr->d_char == sym)) who[n++] = i;
3754 /* Nothing to recall */
3757 /* Free the "who" array */
3758 C_KILL(who, max_r_idx, MONRACE_IDX);
3768 /* Sort if needed */
3771 ang_sort(who, &why, n, ang_sort_comp_hook, ang_sort_swap_hook);
3775 /* Start at the end */
3776 /* XTRA HACK REMEMBER_IDX */
3777 if (old_sym == sym && old_i < n) i = old_i;
3782 /* Scan the monster memory */
3787 /* Hack -- Begin the prompt */
3790 /* Hack -- Complete the prompt */
3791 Term_addstr(-1, TERM_WHITE, _(" ['r'思い出, ' 'で続行, ESC]", " [(r)ecall, ESC, space to continue]"));
3798 /*** Recall on screen ***/
3800 /* Get maximal info about this monster */
3801 lore_do_probe(r_idx);
3803 /* Save this monster ID */
3804 monster_race_track(r_idx);
3807 /* know every thing mode */
3808 screen_roff(r_idx, 0x01);
3811 /* XTRA HACK REMEMBER_IDX */
3818 /* Normal commands */
3819 if (query != 'r') break;
3825 if (query == ESCAPE) break;
3827 /* Move to "prev" monster */
3833 if (!expand_list) break;
3837 /* Move to "next" monster */
3843 if (!expand_list) break;
3849 /* Re-display the identity */
3850 /* prt(buf, 5, 5);*/
3852 /* Free the "who" array */
3853 C_KILL(who, max_r_idx, MONRACE_IDX);
3856 return (!notpicked);
3861 * @brief 施設の処理実行メインルーチン / Execute a building command
3862 * @param bldg 施設構造体の参照ポインタ
3863 * @param i 実行したい施設のサービステーブルの添字
3866 static void bldg_process_command(building_type *bldg, int i)
3868 BACT_IDX bact = bldg->actions[i];
3876 bcost = bldg->member_costs[i];
3878 bcost = bldg->other_costs[i];
3880 /* action restrictions */
3881 if (((bldg->action_restr[i] == 1) && !is_member(bldg)) ||
3882 ((bldg->action_restr[i] == 2) && !is_owner(bldg)))
3884 msg_print(_("それを選択する権利はありません!", "You have no right to choose that!"));
3888 /* check gold (HACK - Recharge uses variable costs) */
3889 if ((bact != BACT_RECHARGE) &&
3890 (((bldg->member_costs[i] > p_ptr->au) && is_owner(bldg)) ||
3891 ((bldg->other_costs[i] > p_ptr->au) && !is_owner(bldg))))
3893 msg_print(_("お金が足りません!", "You do not have the gold!"));
3902 case BACT_RESEARCH_ITEM:
3903 paid = identify_fully(FALSE);
3905 case BACT_TOWN_HISTORY:
3908 case BACT_RACE_LEGENDS:
3914 case BACT_KING_LEGENDS:
3915 case BACT_ARENA_LEGENDS:
3920 case BACT_ARENA_RULES:
3924 case BACT_IN_BETWEEN:
3926 case BACT_SPIN_WHEEL:
3927 case BACT_DICE_SLOTS:
3928 case BACT_GAMBLE_RULES:
3935 paid = inn_comm(bact);
3937 case BACT_RESEARCH_MONSTER:
3938 paid = research_mon();
3940 case BACT_COMPARE_WEAPONS:
3942 bcost = compare_weapons(bcost);
3944 case BACT_ENCHANT_WEAPON:
3945 item_tester_hook = object_allow_enchant_melee_weapon;
3946 enchant_item(bcost, 1, 1, 0);
3948 case BACT_ENCHANT_ARMOR:
3949 item_tester_hook = object_is_armour;
3950 enchant_item(bcost, 0, 0, 1);
3953 building_recharge();
3955 case BACT_RECHARGE_ALL:
3956 building_recharge_all();
3958 case BACT_IDENTS: /* needs work */
3959 if (!get_check(_("持ち物を全て鑑定してよろしいですか?", "Do you pay for identify all your possession? "))) break;
3961 msg_print(_(" 持ち物全てが鑑定されました。", "Your possessions have been identified."));
3964 case BACT_IDENT_ONE: /* needs work */
3965 paid = ident_spell(FALSE);
3970 case BACT_HEALING: /* needs work */
3971 paid = cure_critical_wounds(200);
3973 case BACT_RESTORE: /* needs work */
3974 paid = restore_all_status();
3976 case BACT_ENCHANT_ARROWS:
3977 item_tester_hook = item_tester_hook_ammo;
3978 enchant_item(bcost, 1, 1, 0);
3980 case BACT_ENCHANT_BOW:
3981 item_tester_tval = TV_BOW;
3982 enchant_item(bcost, 1, 1, 0);
3986 if (recall_player(p_ptr, 1)) paid = TRUE;
3989 case BACT_TELEPORT_LEVEL:
3991 paid = free_level_recall(p_ptr);
3994 case BACT_LOSE_MUTATION:
3995 if (p_ptr->muta1 || p_ptr->muta2 || (p_ptr->muta3 & ~MUT3_GOOD_LUCK) ||
3996 (p_ptr->pseikaku != SEIKAKU_LUCKY && (p_ptr->muta3 & MUT3_GOOD_LUCK)))
3998 while(!lose_mutation(p_ptr, 0));
4003 msg_print(_("治すべき突然変異が無い。", "You have no mutations."));
4012 case BACT_TSUCHINOKO:
4029 msg_print(_("平衡化の儀式を行なった。", "You received an equalization ritual."));
4030 set_virtue(p_ptr, V_COMPASSION, 0);
4031 set_virtue(p_ptr, V_HONOUR, 0);
4032 set_virtue(p_ptr, V_JUSTICE, 0);
4033 set_virtue(p_ptr, V_SACRIFICE, 0);
4034 set_virtue(p_ptr, V_KNOWLEDGE, 0);
4035 set_virtue(p_ptr, V_FAITH, 0);
4036 set_virtue(p_ptr, V_ENLIGHTEN, 0);
4037 set_virtue(p_ptr, V_ENCHANT, 0);
4038 set_virtue(p_ptr, V_CHANCE, 0);
4039 set_virtue(p_ptr, V_NATURE, 0);
4040 set_virtue(p_ptr, V_HARMONY, 0);
4041 set_virtue(p_ptr, V_VITALITY, 0);
4042 set_virtue(p_ptr, V_UNLIFE, 0);
4043 set_virtue(p_ptr, V_PATIENCE, 0);
4044 set_virtue(p_ptr, V_TEMPERANCE, 0);
4045 set_virtue(p_ptr, V_DILIGENCE, 0);
4046 set_virtue(p_ptr, V_VALOUR, 0);
4047 set_virtue(p_ptr, V_INDIVIDUALISM, 0);
4052 case BACT_TELE_TOWN:
4057 paid = eval_ac(p_ptr->dis_ac + p_ptr->dis_to_a);
4060 case BACT_BROKEN_WEAPON:
4062 bcost = repair_broken_weapon(bcost);
4073 * @brief 施設入り口にプレイヤーが乗った際の処理 / Do building commands
4076 void do_cmd_bldg(void)
4081 building_type *bldg;
4083 if(p_ptr->wild_mode) return;
4085 take_turn(p_ptr, 100);
4087 if (!cave_have_flag_bold(p_ptr->y, p_ptr->x, FF_BLDG))
4089 msg_print(_("ここには建物はない。", "You see no building here."));
4093 which = f_info[current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].feat].subtype;
4095 bldg = &building[which];
4097 /* Don't re-init the wilderness */
4098 reinit_wilderness = FALSE;
4100 if ((which == 2) && (p_ptr->arena_number < 0))
4102 msg_print(_("「敗者に用はない。」", "'There's no place here for a LOSER like you!'"));
4105 else if ((which == 2) && p_ptr->inside_arena)
4107 if (!p_ptr->exit_bldg && current_floor_ptr->m_cnt > 0)
4109 prt(_("ゲートは閉まっている。モンスターがあなたを待っている!", "The gates are closed. The monster awaits!"), 0, 0);
4113 /* Don't save the arena as saved floor */
4114 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_NO_RETURN);
4116 p_ptr->inside_arena = FALSE;
4117 p_ptr->leaving = TRUE;
4119 /* Re-enter the arena */
4120 command_new = SPECIAL_KEY_BUILDING;
4122 /* No energy needed to re-enter the arena */
4128 else if (p_ptr->phase_out)
4130 /* Don't save the arena as saved floor */
4131 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_NO_RETURN);
4133 p_ptr->leaving = TRUE;
4134 p_ptr->phase_out = FALSE;
4136 /* Re-enter the monster arena */
4137 command_new = SPECIAL_KEY_BUILDING;
4139 /* No energy needed to re-enter the arena */
4146 p_ptr->oldpy = p_ptr->y;
4147 p_ptr->oldpx = p_ptr->x;
4153 /* Hack -- Increase "icky" depth */
4154 current_world_ptr->character_icky++;
4160 show_building(bldg);
4161 p_ptr->leave_bldg = FALSE;
4163 play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_BUILD);
4165 while (!p_ptr->leave_bldg)
4170 building_prt_gold();
4174 if (command == ESCAPE)
4176 p_ptr->leave_bldg = TRUE;
4177 p_ptr->inside_arena = FALSE;
4178 p_ptr->phase_out = FALSE;
4182 for (i = 0; i < 8; i++)
4184 if (bldg->letters[i])
4186 if (bldg->letters[i] == command)
4194 if(validcmd) bldg_process_command(bldg, i);
4199 select_floor_music();
4204 /* Reinit wilderness to activate quests ... */
4205 if (reinit_wilderness)
4207 p_ptr->leaving = TRUE;
4210 /* Hack -- Decrease "icky" depth */
4211 current_world_ptr->character_icky--;
4215 p_ptr->update |= (PU_VIEW | PU_MONSTERS | PU_BONUS | PU_LITE | PU_MON_LITE);
4216 p_ptr->redraw |= (PR_BASIC | PR_EXTRA | PR_EQUIPPY | PR_MAP);
4217 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
4222 * @brief 今日の賞金首を確定する / Determine today's bounty monster
4224 * @note conv_old is used if loaded 0.0.3 or older save file
4226 void determine_today_mon(bool conv_old)
4229 bool old_inside_battle = p_ptr->phase_out;
4230 monster_race *r_ptr;
4234 for (i = 0; i < max_d_idx; i++)
4236 if (max_dlv[i] < d_info[i].mindepth) continue;
4237 if (max_dl < max_dlv[i]) max_dl = max_dlv[i];
4240 else max_dl = MAX(max_dlv[DUNGEON_ANGBAND], 3);
4242 p_ptr->phase_out = TRUE;
4243 get_mon_num_prep(NULL, NULL);
4247 today_mon = get_mon_num(max_dl);
4248 r_ptr = &r_info[today_mon];
4250 if (r_ptr->flags1 & RF1_UNIQUE) continue;
4251 if (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)) continue;
4252 if (r_ptr->flags2 & RF2_MULTIPLY) continue;
4253 if ((r_ptr->flags9 & (RF9_DROP_CORPSE | RF9_DROP_SKELETON)) != (RF9_DROP_CORPSE | RF9_DROP_SKELETON)) continue;
4254 if (r_ptr->level < MIN(max_dl / 2, 40)) continue;
4255 if (r_ptr->rarity > 10) continue;
4259 p_ptr->today_mon = 0;
4260 p_ptr->phase_out = old_inside_battle;
4266 * @brief 賞金首となるユニークを確定する / Determine bounty uniques
4269 void determine_bounty_uniques(void)
4273 monster_race *r_ptr;
4275 get_mon_num_prep(NULL, NULL);
4276 for (i = 0; i < MAX_KUBI; i++)
4280 current_world_ptr->bounty_r_idx[i] = get_mon_num(MAX_DEPTH - 1);
4281 r_ptr = &r_info[current_world_ptr->bounty_r_idx[i]];
4283 if (!(r_ptr->flags1 & RF1_UNIQUE)) continue;
4285 if (!(r_ptr->flags9 & (RF9_DROP_CORPSE | RF9_DROP_SKELETON))) continue;
4287 if (r_ptr->rarity > 100) continue;
4289 if (no_questor_or_bounty_uniques(current_world_ptr->bounty_r_idx[i])) continue;
4291 for (j = 0; j < i; j++)
4292 if (current_world_ptr->bounty_r_idx[i] == current_world_ptr->bounty_r_idx[j]) break;
4299 for (i = 0; i < MAX_KUBI - 1; i++)
4301 for (j = i; j < MAX_KUBI; j++)
4303 if (r_info[current_world_ptr->bounty_r_idx[i]].level > r_info[current_world_ptr->bounty_r_idx[j]].level)
4305 tmp = current_world_ptr->bounty_r_idx[i];
4306 current_world_ptr->bounty_r_idx[i] = current_world_ptr->bounty_r_idx[j];
4307 current_world_ptr->bounty_r_idx[j] = tmp;