4 * Purpose: Building commands
5 * Created by Ken Wigle for Kangband - a variant of Angband 2.8.3
8 * Rewritten for Kangband 2.8.3i using Kamband's version of
9 * bldg.c as written by Ivan Tkatchev
11 * Changed for ZAngband by Robert Ruehlmann
16 /* hack as in leave_store in store.c */
17 static bool leave_bldg = FALSE;
19 static bool is_owner(building_type *bldg)
21 if (bldg->member_class[p_ptr->pclass] == BUILDING_OWNER)
26 if (bldg->member_race[p_ptr->prace] == BUILDING_OWNER)
31 if ((is_magic(p_ptr->realm1) && (bldg->member_realm[p_ptr->realm1] == BUILDING_OWNER)) ||
32 (is_magic(p_ptr->realm2) && (bldg->member_realm[p_ptr->realm2] == BUILDING_OWNER)))
41 static bool is_member(building_type *bldg)
43 if (bldg->member_class[p_ptr->pclass])
48 if (bldg->member_race[p_ptr->prace])
53 if ((is_magic(p_ptr->realm1) && bldg->member_realm[p_ptr->realm1]) ||
54 (is_magic(p_ptr->realm2) && bldg->member_realm[p_ptr->realm2]))
60 if (p_ptr->pclass == CLASS_SORCERER)
64 for (i = 0; i < MAX_MAGIC; i++)
66 if (bldg->member_realm[i+1]) OK = TRUE;
75 * Clear the building information
77 static void clear_bldg(int min_row, int max_row)
81 for (i = min_row; i <= max_row; i++)
85 static void building_prt_gold(void)
90 prt("¼ê»ý¤Á¤Î¤ª¶â: ", 23,53);
92 prt("Gold Remaining: ", 23, 53);
96 sprintf(tmp_str, "%9ld", (long)p_ptr->au);
102 * Display a building.
104 static void show_building(building_type* bldg)
112 sprintf(tmp_str, "%s (%s) %35s", bldg->owner_name, bldg->owner_race, bldg->name);
116 for (i = 0; i < 8; i++)
118 if (bldg->letters[i])
120 if (bldg->action_restr[i] == 0)
122 if ((is_owner(bldg) && (bldg->member_costs[i] == 0)) ||
123 (!is_owner(bldg) && (bldg->other_costs[i] == 0)))
125 action_color = TERM_WHITE;
128 else if (is_owner(bldg))
130 action_color = TERM_YELLOW;
132 sprintf(buff, "($%ld)", (long int)bldg->member_costs[i]);
134 sprintf(buff, "(%ldgp)", (long int)bldg->member_costs[i]);
140 action_color = TERM_YELLOW;
142 sprintf(buff, "($%ld)", (long int)bldg->other_costs[i]);
144 sprintf(buff, "(%ldgp)", (long int)bldg->other_costs[i]);
149 else if (bldg->action_restr[i] == 1)
151 if (!is_member(bldg))
153 action_color = TERM_L_DARK;
155 strcpy(buff, "(ÊÄŹ)");
157 strcpy(buff, "(closed)");
161 else if ((is_owner(bldg) && (bldg->member_costs[i] == 0)) ||
162 (is_member(bldg) && (bldg->other_costs[i] == 0)))
164 action_color = TERM_WHITE;
167 else if (is_owner(bldg))
169 action_color = TERM_YELLOW;
171 sprintf(buff, "($%ld)", (long int)bldg->member_costs[i]);
173 sprintf(buff, "(%ldgp)", (long int)bldg->member_costs[i]);
179 action_color = TERM_YELLOW;
181 sprintf(buff, "($%ld)", (long int)bldg->other_costs[i]);
183 sprintf(buff, "(%ldgp)", (long int)bldg->other_costs[i]);
192 action_color = TERM_L_DARK;
194 strcpy(buff, "(ÊÄŹ)");
196 strcpy(buff, "(closed)");
200 else if (bldg->member_costs[i] != 0)
202 action_color = TERM_YELLOW;
204 sprintf(buff, "($%ld)", (long int)bldg->member_costs[i]);
206 sprintf(buff, "(%ldgp)", (long int)bldg->member_costs[i]);
212 action_color = TERM_WHITE;
217 sprintf(tmp_str," %c) %s %s", bldg->letters[i], bldg->act_names[i], buff);
218 c_put_str(action_color, tmp_str, 19+(i/2), 35*(i%2));
223 prt(" ESC) ·úʪ¤ò½Ð¤ë", 23, 0);
225 prt(" ESC) Exit building", 23, 0);
234 static void arena_comm(int cmd)
243 if (p_ptr->arena_number == MAX_ARENA_MONS)
247 prt("¥¢¥ê¡¼¥Ê¤ÎÍ¥¾¡¼Ô¡ª", 5, 0);
248 prt("¤ª¤á¤Ç¤È¤¦¡ª¤¢¤Ê¤¿¤ÏÁ´¤Æ¤ÎŨ¤òÅݤ·¤Þ¤·¤¿¡£", 7, 0);
249 prt("¾Þ¶â¤È¤·¤Æ $1,000,000 ¤¬Í¿¤¨¤é¤ì¤Þ¤¹¡£", 8, 0);
251 prt(" Arena Victor!", 5, 0);
252 prt("Congratulations! You have defeated all before you.", 7, 0);
253 prt("For that, receive the prize: 1,000,000 gold pieces", 8, 0);
258 p_ptr->au += 1000000L;
260 msg_print("¥¹¥Ú¡¼¥¹¥¡¼¤Ç³¹Ô");
262 msg_print("Press the space bar to continue");
266 p_ptr->arena_number++;
268 else if (p_ptr->arena_number > MAX_ARENA_MONS)
270 if (p_ptr->arena_number < MAX_ARENA_MONS+2)
273 msg_print("·¯¤Î¤¿¤á¤ËºÇ¶¯¤ÎÄ©Àï¼Ô¤òÍÑ°Õ¤·¤Æ¤ª¤¤¤¿¡£");
275 msg_print("The strongest challenger is waiting for you.");
280 if (get_check("Ä©À魯¤ë¤«¤Í¡©"))
282 if (get_check("Do you fight? "))
286 msg_print("»à¤Ì¤¬¤è¤¤¡£");
288 msg_print("Die, maggots.");
292 p_ptr->exit_bldg = FALSE;
295 /* Save the surface floor as saved floor */
296 prepare_change_floor_mode(CFM_SAVE_FLOORS);
298 p_ptr->inside_arena = TRUE;
299 p_ptr->leaving = TRUE;
305 msg_print("»ÄÇ°¤À¡£");
307 msg_print("We are disappointed.");
314 msg_print("¤¢¤Ê¤¿¤Ï¥¢¥ê¡¼¥Ê¤ËÆþ¤ê¡¢¤·¤Ð¤é¤¯¤Î´Ö±É¸÷¤Ë¤Ò¤¿¤Ã¤¿¡£");
316 msg_print("You enter the arena briefly and bask in your glory.");
322 else if (p_ptr->riding && (p_ptr->pclass != CLASS_BEASTMASTER) && (p_ptr->pclass != CLASS_CAVALRY))
325 msg_print("¥Ú¥Ã¥È¤Ë¾è¤Ã¤¿¤Þ¤Þ¤Ç¤Ï¥¢¥ê¡¼¥Ê¤ØÆþ¤ì¤µ¤»¤Æ¤â¤é¤¨¤Ê¤«¤Ã¤¿¡£");
327 msg_print("You don't have permission to enter with pet.");
334 p_ptr->exit_bldg = FALSE;
337 /* Save the surface floor as saved floor */
338 prepare_change_floor_mode(CFM_SAVE_FLOORS);
340 p_ptr->inside_arena = TRUE;
341 p_ptr->leaving = TRUE;
346 if (p_ptr->arena_number == MAX_ARENA_MONS)
348 msg_print("¤¢¤Ê¤¿¤Ï¾¡Íø¼Ô¤À¡£ ¥¢¥ê¡¼¥Ê¤Ç¤Î¥»¥ì¥â¥Ë¡¼¤Ë»²²Ã¤·¤Ê¤µ¤¤¡£");
350 msg_print("You are victorious. Enter the arena for the ceremony.");
353 else if (p_ptr->arena_number > MAX_ARENA_MONS)
356 msg_print("¤¢¤Ê¤¿¤Ï¤¹¤Ù¤Æ¤ÎŨ¤Ë¾¡Íø¤·¤¿¡£");
358 msg_print("You have won against all foes.");
363 r_ptr = &r_info[arena_info[p_ptr->arena_number].r_idx];
364 name = (r_name + r_ptr->name);
366 msg_format("%s ¤ËÄ©À魯¤ë¤â¤Î¤Ï¤¤¤Ê¤¤¤«¡©", name);
368 msg_format("Do I hear any challenges against: %s", name);
372 case BACT_ARENA_RULES:
377 /* Peruse the arena help file */
379 (void)show_file(TRUE, "arena_j.txt", NULL, 0, 0);
381 (void)show_file(TRUE, "arena.txt", NULL, 0, 0);
394 * display fruit for dice slots
396 static void display_fruit(int row, int col, int fruit)
402 c_put_str(TERM_YELLOW, " ####.", row, col);
403 c_put_str(TERM_YELLOW, " # #", row + 1, col);
404 c_put_str(TERM_YELLOW, " # #", row + 2, col);
405 c_put_str(TERM_YELLOW, "# #", row + 3, col);
406 c_put_str(TERM_YELLOW, "# #", row + 4, col);
407 c_put_str(TERM_YELLOW, "# # ", row + 5, col);
408 c_put_str(TERM_YELLOW, "# # ", row + 6, col);
409 c_put_str(TERM_YELLOW, ".#### ", row + 7, col);
410 prt( " ¥ì¥â¥ó ", row + 8, col);
412 c_put_str(TERM_YELLOW, " ####.", row, col);
413 c_put_str(TERM_YELLOW, " # #", row + 1, col);
414 c_put_str(TERM_YELLOW, " # #", row + 2, col);
415 c_put_str(TERM_YELLOW, "# #", row + 3, col);
416 c_put_str(TERM_YELLOW, "# #", row + 4, col);
417 c_put_str(TERM_YELLOW, "# # ", row + 5, col);
418 c_put_str(TERM_YELLOW, "# # ", row + 6, col);
419 c_put_str(TERM_YELLOW, ".#### ", row + 7, col);
420 prt( " Lemon ", row + 8, col);
426 c_put_str(TERM_ORANGE, " ## ", row, col);
427 c_put_str(TERM_ORANGE, " #..# ", row + 1, col);
428 c_put_str(TERM_ORANGE, " #....# ", row + 2, col);
429 c_put_str(TERM_ORANGE, "#......#", row + 3, col);
430 c_put_str(TERM_ORANGE, "#......#", row + 4, col);
431 c_put_str(TERM_ORANGE, " #....# ", row + 5, col);
432 c_put_str(TERM_ORANGE, " #..# ", row + 6, col);
433 c_put_str(TERM_ORANGE, " ## ", row + 7, col);
434 prt( "¥ª¥ì¥ó¥¸", row + 8, col);
436 c_put_str(TERM_ORANGE, " ## ", row, col);
437 c_put_str(TERM_ORANGE, " #..# ", row + 1, col);
438 c_put_str(TERM_ORANGE, " #....# ", row + 2, col);
439 c_put_str(TERM_ORANGE, "#......#", row + 3, col);
440 c_put_str(TERM_ORANGE, "#......#", row + 4, col);
441 c_put_str(TERM_ORANGE, " #....# ", row + 5, col);
442 c_put_str(TERM_ORANGE, " #..# ", row + 6, col);
443 c_put_str(TERM_ORANGE, " ## ", row + 7, col);
444 prt( " Orange ", 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_UMBER, " |=°¡=| " , row + 6, col);
457 c_put_str(TERM_UMBER, " ÌÜ " , row + 7, col);
458 prt( " ·õ " , 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);
474 c_put_str(TERM_SLATE, " ###### ", row, col);
475 c_put_str(TERM_SLATE, "# #", row + 1, col);
476 c_put_str(TERM_SLATE, "# ++++ #", row + 2, col);
477 c_put_str(TERM_SLATE, "# +==+ #", row + 3, col);
478 c_put_str(TERM_SLATE, "# ++ #", row + 4, col);
479 c_put_str(TERM_SLATE, " # # ", row + 5, col);
480 c_put_str(TERM_SLATE, " # # ", row + 6, col);
481 c_put_str(TERM_SLATE, " ## ", row + 7, col);
482 prt( " ½â ", row + 8, col);
484 c_put_str(TERM_SLATE, " ###### ", row, col);
485 c_put_str(TERM_SLATE, "# #", row + 1, col);
486 c_put_str(TERM_SLATE, "# ++++ #", row + 2, col);
487 c_put_str(TERM_SLATE, "# +==+ #", row + 3, col);
488 c_put_str(TERM_SLATE, "# ++ #", row + 4, col);
489 c_put_str(TERM_SLATE, " # # ", row + 5, col);
490 c_put_str(TERM_SLATE, " # # ", row + 6, col);
491 c_put_str(TERM_SLATE, " ## ", row + 7, col);
492 prt( " Shield ", row + 8, col);
498 c_put_str(TERM_VIOLET, " ## ", row, col);
499 c_put_str(TERM_VIOLET, " ###### ", row + 1, col);
500 c_put_str(TERM_VIOLET, "########", row + 2, col);
501 c_put_str(TERM_VIOLET, "########", row + 3, col);
502 c_put_str(TERM_VIOLET, "########", row + 4, col);
503 c_put_str(TERM_VIOLET, " ###### ", row + 5, col);
504 c_put_str(TERM_VIOLET, " #### ", row + 6, col);
505 c_put_str(TERM_VIOLET, " ## ", row + 7, col);
506 prt( " ¥×¥é¥à ", row + 8, col);
508 c_put_str(TERM_VIOLET, " ## ", row, col);
509 c_put_str(TERM_VIOLET, " ###### ", row + 1, col);
510 c_put_str(TERM_VIOLET, "########", row + 2, col);
511 c_put_str(TERM_VIOLET, "########", row + 3, col);
512 c_put_str(TERM_VIOLET, "########", row + 4, col);
513 c_put_str(TERM_VIOLET, " ###### ", row + 5, col);
514 c_put_str(TERM_VIOLET, " #### ", row + 6, col);
515 c_put_str(TERM_VIOLET, " ## ", row + 7, col);
516 prt( " Plum ", row + 8, col);
522 c_put_str(TERM_RED, " ##", row, col);
523 c_put_str(TERM_RED, " ### ", row + 1, col);
524 c_put_str(TERM_RED, " #..# ", row + 2, col);
525 c_put_str(TERM_RED, " #..# ", row + 3, col);
526 c_put_str(TERM_RED, " ###### ", row + 4, col);
527 c_put_str(TERM_RED, "#..##..#", row + 5, col);
528 c_put_str(TERM_RED, "#..##..#", row + 6, col);
529 c_put_str(TERM_RED, " ## ## ", row + 7, col);
530 prt( "¥Á¥§¥ê¡¼", row + 8, col);
532 c_put_str(TERM_RED, " ##", row, col);
533 c_put_str(TERM_RED, " ### ", row + 1, col);
534 c_put_str(TERM_RED, " #..# ", row + 2, col);
535 c_put_str(TERM_RED, " #..# ", row + 3, col);
536 c_put_str(TERM_RED, " ###### ", row + 4, col);
537 c_put_str(TERM_RED, "#..##..#", row + 5, col);
538 c_put_str(TERM_RED, "#..##..#", row + 6, col);
539 c_put_str(TERM_RED, " ## ## ", row + 7, col);
540 prt( " Cherry ", row + 8, col);
548 * kpoker no (tyuto-hannpa na)pakuri desu...
549 * joker ha shineru node haitte masen.
551 * TODO: donataka! tsukutte!
552 * - agatta yaku no kiroku (like DQ).
553 * - kakkoii card no e.
554 * - sousa-sei no koujyo.
555 * - code wo wakariyasuku.
557 * - Joker... -- done.
560 * 9/15/2000 joker wo jissou. soreto, code wo sukosi kakikae. --Habu
562 #define SUIT_OF(card) ((card) / 13)
563 #define NUM_OF(card) ((card) % 13)
564 #define IS_JOKER(card) ((card) == 52)
566 static int cards[5]; /* tefuda no card */
568 static void reset_deck(int deck[])
571 for (i = 0; i < 53; i++) deck[i] = i;
574 for (i = 0; i < 53; i++){
575 int tmp1 = randint0(53 - i) + i;
577 deck[i] = deck[tmp1];
582 static bool have_joker(void)
586 for (i = 0; i < 5; i++){
587 if(IS_JOKER(cards[i])) return TRUE;
592 static bool find_card_num(int num)
595 for (i = 0; i < 5; i++)
596 if (NUM_OF(cards[i]) == num && !IS_JOKER(cards[i])) return TRUE;
600 static bool yaku_check_flush(void)
603 bool joker_is_used = FALSE;
605 suit = IS_JOKER(cards[0]) ? SUIT_OF(cards[1]) : SUIT_OF(cards[0]);
606 for (i = 0; i < 5; i++){
607 if (SUIT_OF(cards[i]) != suit){
608 if(have_joker() && !joker_is_used)
609 joker_is_used = TRUE;
618 static int yaku_check_straight(void)
621 bool joker_is_used = FALSE;
624 for (i = 0; i < 5; i++)
626 if (NUM_OF(cards[i]) < lowest && !IS_JOKER(cards[i]))
627 lowest = NUM_OF(cards[i]);
630 if (yaku_check_flush())
633 for (i = 0; i < 4; i++)
635 if (!find_card_num(9 + i)){
636 if( have_joker() && !joker_is_used )
637 joker_is_used = TRUE;
642 if (i == 4) return 3; /* Wow! Royal Flush!!! */
645 for (i = 0; i < 3; i++)
647 if (!find_card_num(10 + i))
650 if (i == 3 && have_joker()) return 3; /* Wow! Royal Flush!!! */
654 joker_is_used = FALSE;
655 for (i = 0; i < 5; i++)
657 if (!find_card_num(lowest + i)){
658 if( have_joker() && !joker_is_used )
659 joker_is_used = TRUE;
665 if (yaku_check_flush())
666 return 2; /* Straight Flush */
672 * 0:nopair 1:1 pair 2:2 pair 3:3 cards 4:full house 6:4cards
674 static int yaku_check_pair(void)
676 int i, i2, matching = 0;
678 for (i = 0; i < 5; i++)
680 for (i2 = i+1; i2 < 5; i2++)
682 if (IS_JOKER(cards[i]) || IS_JOKER(cards[i2])) continue;
683 if (NUM_OF(cards[i]) == NUM_OF(cards[i2]))
725 static int yaku_check(void)
729 switch(yaku_check_straight()){
732 c_put_str(TERM_YELLOW, "¥í¥¤¥ä¥ë¥¹¥È¥ì¡¼¥È¥Õ¥é¥Ã¥·¥å", 4, 3);
734 c_put_str(TERM_YELLOW, "Royal Flush", 4, 3);
739 c_put_str(TERM_YELLOW, "¥¹¥È¥ì¡¼¥È¥Õ¥é¥Ã¥·¥å", 4, 3);
741 c_put_str(TERM_YELLOW, "Straight Flush", 4, 3);
746 c_put_str(TERM_YELLOW, "¥¹¥È¥ì¡¼¥È", 4, 3);
748 c_put_str(TERM_YELLOW, "Straight", 4, 3);
752 /* Not straight -- fall through */
756 if (yaku_check_flush())
760 c_put_str(TERM_YELLOW, "¥Õ¥é¥Ã¥·¥å", 4, 3);
762 c_put_str(TERM_YELLOW, "Flush", 4, 3);
767 switch (yaku_check_pair())
771 c_put_str(TERM_YELLOW, "¥ï¥ó¥Ú¥¢", 4, 3);
773 c_put_str(TERM_YELLOW, "One pair", 4, 3);
778 c_put_str(TERM_YELLOW, "¥Ä¡¼¥Ú¥¢", 4, 3);
780 c_put_str(TERM_YELLOW, "Two pair", 4, 3);
785 c_put_str(TERM_YELLOW, "¥¹¥ê¡¼¥«¡¼¥É", 4, 3);
787 c_put_str(TERM_YELLOW, "Three of a kind", 4, 3);
792 c_put_str(TERM_YELLOW, "¥Õ¥ë¥Ï¥¦¥¹", 4, 3);
794 c_put_str(TERM_YELLOW, "Full house", 4, 3);
799 c_put_str(TERM_YELLOW, "¥Õ¥©¡¼¥«¡¼¥É", 4, 3);
801 c_put_str(TERM_YELLOW, "Four of a kind", 4, 3);
805 if (!NUM_OF(cards[0]) || !NUM_OF(cards[1]))
808 c_put_str(TERM_YELLOW, "¥Õ¥¡¥¤¥Ö¥¨¡¼¥¹", 4, 3);
810 c_put_str(TERM_YELLOW, "Five ace", 4, 3);
817 c_put_str(TERM_YELLOW, "¥Õ¥¡¥¤¥Ö¥«¡¼¥É", 4, 3);
819 c_put_str(TERM_YELLOW, "Five of a kind", 4, 3);
829 static void display_kaeruka(int hoge, int kaeruka[])
832 char col = TERM_WHITE;
833 for (i = 0; i < 5; i++)
835 if (i == hoge) col = TERM_YELLOW;
836 else if(kaeruka[i]) col = TERM_WHITE;
837 else col = TERM_L_BLUE;
840 c_put_str(col, "¤«¤¨¤ë", 14, 5+i*16);
842 c_put_str(col, "¤Î¤³¤¹", 14, 5+i*16);
845 c_put_str(col, "Change", 14, 5+i*16);
847 c_put_str(col, " Stay ", 14, 5+i*16);
850 if (hoge > 4) col = TERM_YELLOW;
851 else col = TERM_WHITE;
853 c_put_str(col, "·èÄê", 16, 38);
855 c_put_str(col, "Sure", 16, 38);
858 /* Hilite current option */
859 if (hoge < 5) move_cursor(14, 5+hoge*16);
860 else move_cursor(16, 38);
864 static void display_cards(void)
867 char suitcolor[4] = {TERM_YELLOW, TERM_L_RED, TERM_L_BLUE, TERM_L_GREEN};
869 cptr suit[4] = {"¡ú", "¡ü", "¢ù", "¢÷"};
870 cptr card_grph[13][7] = {{"£Á %s ",
961 cptr joker_grph[7] = { " ",
971 cptr suit[4] = {"[]", "qp", "<>", "db"};
972 cptr card_grph[13][7] = {{"A %s ",
1063 cptr joker_grph[7] = { " ",
1072 for (i = 0; i < 5; i++)
1075 prt("¨®¨¬¨¬¨¬¨¬¨¬¨¬¨¯", 5, i*16);
1077 prt(" +------------+ ", 5, i*16);
1081 for (i = 0; i < 5; i++)
1083 for (j = 0; j < 7; j++)
1086 prt("¨", j+6, i*16);
1088 prt(" |", j+6, i*16);
1090 if(IS_JOKER(cards[i]))
1091 c_put_str(TERM_VIOLET, joker_grph[j], j+6, 2+i*16);
1093 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);
1095 prt("¨", j+6, i*16+14);
1097 prt("| ", j+6, i*16+14);
1101 for (i = 0; i < 5; i++)
1104 prt("¨±¨¬¨¬¨¬¨¬¨¬¨¬¨°", 13, i*16);
1106 prt(" +------------+ ", 13, i*16);
1111 static int do_poker(void)
1115 int deck[53]; /* yamafuda : 0...52 */
1117 int kaeruka[5]; /* 0:kaenai 1:kaeru */
1121 bool kakikae = TRUE;
1125 for (i = 0; i < 5; i++)
1127 cards[i] = deck[deck_ptr++];
1128 kaeruka[i] = 0; /* default:nokosu */
1148 /* debug:Four Cards */
1150 cards[1] = 0 + 13 * 1;
1151 cards[2] = 0 + 13 * 2;
1152 cards[3] = 0 + 13 * 3;
1156 /* debug:Straight */
1172 /* suteruno wo kimeru */
1174 prt("»Ä¤¹¥«¡¼¥É¤ò·è¤á¤Æ²¼¤µ¤¤(Êý¸þ¤Ç°ÜÆ°, ¥¹¥Ú¡¼¥¹¤ÇÁªÂò)¡£", 0, 0);
1176 prt("Stay witch? ", 0, 0);
1184 if (kakikae) display_kaeruka(k+kettei*5, kaeruka);
1189 case '6': case 'l': case 'L': case KTRL('F'):
1190 if (!kettei) k = (k+1)%5;
1191 else {k = 0;kettei = FALSE;}
1194 case '4': case 'h': case 'H': case KTRL('B'):
1195 if (!kettei) k = (k+4)%5;
1196 else {k = 4;kettei = FALSE;}
1199 case '2': case 'j': case 'J': case KTRL('N'):
1200 if (!kettei) {kettei = TRUE;kakikae = TRUE;}
1202 case '8': case 'k': case 'K': case KTRL('P'):
1203 if (kettei) {kettei = FALSE;kakikae = TRUE;}
1205 case ' ': case '\r':
1206 if (kettei) done = TRUE;
1207 else {kaeruka[k] = !kaeruka[k];kakikae = TRUE;}
1216 for (i = 0; i < 5; i++)
1217 if (kaeruka[i] == 1) cards[i] = deck[deck_ptr++]; /* soshite toru */
1221 return yaku_check();
1226 /* end of poker codes --Koka */
1231 static bool gamble_comm(int cmd)
1234 int roll1, roll2, roll3, choice, odds, win;
1239 char out_val[160], tmp_str[80], again;
1244 if (cmd == BACT_GAMBLE_RULES)
1246 /* Peruse the gambling help file */
1248 (void)show_file(TRUE, "jgambling.txt", NULL, 0, 0);
1250 (void)show_file(TRUE, "gambling.txt", NULL, 0, 0);
1260 msg_print("¤ª¤¤¡ª¤ª¤Þ¤¨°ìʸ¤Ê¤·¤¸¤ã¤Ê¤¤¤«¡ª¤³¤Ã¤«¤é½Ð¤Æ¤¤¤±¡ª");
1262 msg_print("Hey! You don't have gold - get out of here!");
1272 maxbet = p_ptr->lev * 200;
1274 /* We can't bet more than we have */
1275 maxbet = MIN(maxbet, p_ptr->au);
1278 strcpy(out_val, "");
1280 sprintf(tmp_str,"ÅÒ¤±¶â (1-%ld)¡©", (long int)maxbet);
1282 sprintf(tmp_str,"Your wager (1-%ld) ? ", (long int)maxbet);
1287 * Use get_string() because we may need more than
1288 * the s16b value returned by get_quantity().
1290 if (get_string(tmp_str, out_val, 32))
1293 for (p = out_val; *p == ' '; p++);
1298 if (wager > p_ptr->au)
1301 msg_print("¤ª¤¤¡ª¶â¤¬Â¤ê¤Ê¤¤¤¸¤ã¤Ê¤¤¤«¡ª½Ð¤Æ¤¤¤±¡ª");
1303 msg_print("Hey! You don't have the gold - get out of here!");
1310 else if (wager > maxbet)
1313 msg_format("%ld¥´¡¼¥ë¥É¤À¤±¼õ¤±¤è¤¦¡£»Ä¤ê¤Ï¼è¤Ã¤È¤¤Ê¡£", (long int)maxbet);
1315 msg_format("I'll take %ld gold of that. Keep the rest.", (long int)maxbet);
1323 msg_print("£Ï£Ë¡¢£±¥´¡¼¥ë¥É¤«¤é¤Ï¤¸¤á¤è¤¦¡£");
1325 msg_print("Ok, we'll start with 1 gold.");
1334 oldgold = p_ptr->au;
1337 sprintf(tmp_str, "¥²¡¼¥àÁ°¤Î½ê»ý¶â: %9ld", (long int)oldgold);
1339 sprintf(tmp_str, "Gold before game: %9ld", (long int)oldgold);
1342 prt(tmp_str, 20, 2);
1345 sprintf(tmp_str, "¸½ºß¤Î³Ý¤±¶â: %9ld", (long int)wager);
1347 sprintf(tmp_str, "Current Wager: %9ld", (long int)wager);
1350 prt(tmp_str, 21, 2);
1352 /* Prevent savefile-scumming of the casino */
1353 /* Rand_quick = TRUE; */
1354 Rand_value = time(NULL);
1358 #ifdef JP /* Prevent random seed cracking of the casino */
1366 case BACT_IN_BETWEEN: /* Game of In-Between */
1368 c_put_str(TERM_GREEN, "¥¤¥ó¡¦¥Ó¥È¥¤¡¼¥ó",5,2);
1370 c_put_str(TERM_GREEN, "In Between", 5, 2);
1375 roll1 = randint1(10);
1376 roll2 = randint1(10);
1377 choice = randint1(10);
1379 sprintf(tmp_str, "¹õ¥À¥¤¥¹: %d ¹õ¥À¥¤¥¹: %d", roll1, roll2);
1381 sprintf(tmp_str, "Black die: %d Black Die: %d", roll1, roll2);
1386 sprintf(tmp_str, "ÀÖ¥À¥¤¥¹: %d", choice);
1388 sprintf(tmp_str, "Red die: %d", choice);
1391 prt(tmp_str, 11, 14);
1392 if (((choice > roll1) && (choice < roll2)) ||
1393 ((choice < roll1) && (choice > roll2)))
1396 case BACT_CRAPS: /* Game of Craps */
1398 c_put_str(TERM_GREEN, "¥¯¥é¥Ã¥×¥¹", 5, 2);
1400 c_put_str(TERM_GREEN, "Craps", 5, 2);
1405 roll1 = randint1(6);
1406 roll2 = randint1(6);
1407 roll3 = roll1 + roll2;
1410 sprintf(tmp_str, "£±¿¶¤ê¤á: %d %d Total: %d", roll1,
1412 sprintf(tmp_str, "First roll: %d %d Total: %d", roll1,
1417 if ((roll3 == 7) || (roll3 == 11))
1419 else if ((roll3 == 2) || (roll3 == 3) || (roll3 == 12))
1425 msg_print("¤Ê¤Ë¤«¥¡¼¤ò²¡¤¹¤È¤â¤¦°ì²ó¿¶¤ê¤Þ¤¹¡£");
1427 msg_print("Hit any key to roll again");
1431 roll1 = randint1(6);
1432 roll2 = randint1(6);
1433 roll3 = roll1 + roll2;
1436 sprintf(tmp_str, "½ÐÌÜ: %d %d ¹ç·×: %d",
1438 sprintf(tmp_str, "Roll result: %d %d Total: %d",
1441 roll1, roll2, roll3);
1443 if (roll3 == choice)
1445 else if (roll3 == 7)
1447 } while ((win != TRUE) && (win != FALSE));
1450 case BACT_SPIN_WHEEL: /* Spin the Wheel Game */
1454 c_put_str(TERM_GREEN, "¥ë¡¼¥ì¥Ã¥È", 5, 2);
1456 c_put_str(TERM_GREEN, "Wheel", 5, 2);
1459 prt("0 1 2 3 4 5 6 7 8 9", 7, 5);
1460 prt("--------------------------------", 8, 3);
1461 strcpy(out_val, "");
1463 get_string("²¿ÈÖ¡© (0-9): ", out_val, 32);
1465 get_string("Pick a number (0-9): ", out_val, 32);
1468 for (p = out_val; isspace(*p); p++);
1473 msg_print("0È֤ˤ·¤È¤¯¤¼¡£");
1475 msg_print("I'll put you down for 0.");
1480 else if (choice > 9)
1483 msg_print("£Ï£Ë¡¢9È֤ˤ·¤È¤¯¤¼¡£");
1485 msg_print("Ok, I'll put you down for 9.");
1491 roll1 = randint0(10);
1493 sprintf(tmp_str, "¥ë¡¼¥ì¥Ã¥È¤Ï²ó¤ê¡¢»ß¤Þ¤Ã¤¿¡£¾¡¼Ô¤Ï %dÈÖ¤À¡£",
1495 sprintf(tmp_str, "The wheel spins to a stop and the winner is %d",
1499 prt(tmp_str, 13, 3);
1501 prt("*", 9, (3 * roll1 + 5));
1502 if (roll1 == choice)
1506 case BACT_DICE_SLOTS: /* The Dice Slots */
1508 c_put_str(TERM_GREEN, "¥À¥¤¥¹¡¦¥¹¥í¥Ã¥È", 5, 2);
1509 c_put_str(TERM_YELLOW, "¥ì¥â¥ó ¥ì¥â¥ó 2", 6, 37);
1510 c_put_str(TERM_YELLOW, "¥ì¥â¥ó ¥ì¥â¥ó ¥ì¥â¥ó 5", 7, 37);
1511 c_put_str(TERM_ORANGE, "¥ª¥ì¥ó¥¸ ¥ª¥ì¥ó¥¸ ¥ª¥ì¥ó¥¸ 10", 8, 37);
1512 c_put_str(TERM_UMBER, "·õ ·õ ·õ 20", 9, 37);
1513 c_put_str(TERM_SLATE, "½â ½â ½â 50", 10, 37);
1514 c_put_str(TERM_VIOLET, "¥×¥é¥à ¥×¥é¥à ¥×¥é¥à 200", 11, 37);
1515 c_put_str(TERM_RED, "¥Á¥§¥ê¡¼ ¥Á¥§¥ê¡¼ ¥Á¥§¥ê¡¼ 1000", 12, 37);
1517 c_put_str(TERM_GREEN, "Dice Slots", 5, 2);
1521 roll1 = randint1(21);
1531 roll2 = randint1(21);
1541 choice = randint1(21);
1551 put_str("/--------------------------\\", 7, 2);
1552 prt("\\--------------------------/", 17, 2);
1553 display_fruit(8, 3, roll1 - 1);
1554 display_fruit(8, 12, roll2 - 1);
1555 display_fruit(8, 21, choice - 1);
1556 if ((roll1 == roll2) && (roll2 == choice))
1575 else if ((roll1 == 1) && (roll2 == 1))
1584 if (odds) win = TRUE;
1591 prt("¤¢¤Ê¤¿¤Î¾¡¤Á", 16, 37);
1593 prt("YOU WON", 16, 37);
1596 p_ptr->au += odds * wager;
1598 sprintf(tmp_str, "ÇÜΨ: %d", odds);
1600 sprintf(tmp_str, "Payoff: %d", odds);
1603 prt(tmp_str, 17, 37);
1608 prt("¤¢¤Ê¤¿¤ÎÉ餱", 16, 37);
1610 prt("You Lost", 16, 37);
1616 sprintf(tmp_str, "¸½ºß¤Î½ê»ý¶â: %9ld", (long int)p_ptr->au);
1618 sprintf(tmp_str, "Current Gold: %9ld", (long int)p_ptr->au);
1621 prt(tmp_str, 22, 2);
1623 prt("¤â¤¦°ìÅÙ(Y/N)¡©", 18, 37);
1625 prt("Again(Y/N)?", 18, 37);
1628 move_cursor(18, 52);
1633 if (wager > p_ptr->au)
1636 msg_print("¤ª¤¤¡ª¶â¤¬Â¤ê¤Ê¤¤¤¸¤ã¤Ê¤¤¤«¡ª¤³¤³¤«¤é½Ð¤Æ¹Ô¤±¡ª");
1638 msg_print("Hey! You don't have the gold - get out of here!");
1646 } while ((again == 'y') || (again == 'Y'));
1648 /* Switch back to complex RNG */
1652 if (p_ptr->au >= oldgold)
1655 msg_print("¡Öº£²ó¤ÏÌÙ¤±¤¿¤Ê¡ª¤Ç¤â¼¡¤Ï¤³¤Ã¤Á¤¬¾¡¤Ã¤Æ¤ä¤ë¤«¤é¤Ê¡¢ÀäÂФˡª¡×");
1657 msg_print("You came out a winner! We'll win next time, I'm sure.");
1659 chg_virtue(V_CHANCE, 3);
1664 msg_print("¡Ö¶â¤ò¥¹¥Ã¤Æ¤·¤Þ¤Ã¤¿¤Ê¡¢¤ï¤Ï¤Ï¡ª¤¦¤Á¤Ëµ¢¤Ã¤¿Êý¤¬¤¤¤¤¤¼¡£¡×");
1666 msg_print("You lost gold! Haha, better head home.");
1668 chg_virtue(V_CHANCE, -3);
1677 static bool vault_aux_battle(int r_idx)
1682 monster_race *r_ptr = &r_info[r_idx];
1684 /* Decline town monsters */
1685 /* if (!mon_hook_dungeon(r_idx)) return FALSE; */
1687 /* Decline unique monsters */
1688 /* if (r_ptr->flags1 & (RF1_UNIQUE)) return (FALSE); */
1689 /* if (r_ptr->flags7 & (RF7_NAZGUL)) return (FALSE); */
1691 if (r_ptr->flags1 & (RF1_NEVER_MOVE)) return (FALSE);
1692 if (r_ptr->flags2 & (RF2_MULTIPLY)) return (FALSE);
1693 if (r_ptr->flags2 & (RF2_QUANTUM)) return (FALSE);
1694 if (r_ptr->flags7 & (RF7_AQUATIC)) return (FALSE);
1695 if (r_ptr->flags7 & (RF7_CHAMELEON)) return (FALSE);
1697 for (i = 0; i < 4; i++)
1699 if (r_ptr->blow[i].method == RBM_EXPLODE) return (FALSE);
1700 if (r_ptr->blow[i].effect != RBE_DR_MANA) dam += r_ptr->blow[i].d_dice;
1702 if (!dam && !(r_ptr->flags4 & (RF4_BOLT_MASK | RF4_BEAM_MASK | RF4_BALL_MASK | RF4_BREATH_MASK)) && !(r_ptr->flags5 & (RF5_BOLT_MASK | RF5_BEAM_MASK | RF5_BALL_MASK | RF5_BREATH_MASK)) && !(r_ptr->flags6 & (RF6_BOLT_MASK | RF6_BEAM_MASK | RF6_BALL_MASK | RF6_BREATH_MASK))) return (FALSE);
1708 void battle_monsters(void)
1715 bool old_inside_battle = p_ptr->inside_battle;
1717 for (i = 0; i < max_d_idx; i++)
1718 if (max_dl < max_dlv[i]) max_dl = max_dlv[i];
1720 mon_level = randint1(MIN(max_dl, 122))+5;
1721 if (randint0(100) < 60)
1723 i = randint1(MIN(max_dl, 122))+5;
1724 mon_level = MAX(i, mon_level);
1726 if (randint0(100) < 30)
1728 i = randint1(MIN(max_dl, 122))+5;
1729 mon_level = MAX(i, mon_level);
1741 get_mon_num_prep(vault_aux_battle, NULL);
1742 p_ptr->inside_battle = TRUE;
1743 r_idx = get_mon_num(mon_level);
1744 p_ptr->inside_battle = old_inside_battle;
1745 if (!r_idx) continue;
1747 if ((r_info[r_idx].flags1 & RF1_UNIQUE) || (r_info[r_idx].flags7 & RF7_UNIQUE2))
1749 if ((r_info[r_idx].level + 10) > mon_level) continue;
1752 for (j = 0; j < i; j++)
1753 if(r_idx == battle_mon[j]) break;
1758 battle_mon[i] = r_idx;
1759 if (r_info[r_idx].level < 45) tekitou = TRUE;
1764 monster_race *r_ptr = &r_info[battle_mon[i]];
1765 int num_taisei = count_bits(r_ptr->flagsr & (RFR_IM_ACID | RFR_IM_ELEC | RFR_IM_FIRE | RFR_IM_COLD | RFR_IM_POIS));
1767 if (r_ptr->flags1 & RF1_FORCE_MAXHP)
1768 power[i] = r_ptr->hdice * r_ptr->hside * 2;
1770 power[i] = r_ptr->hdice * (r_ptr->hside + 1);
1771 power[i] = power[i] * (100 + r_ptr->level) / 100;
1772 if (r_ptr->speed > 110)
1773 power[i] = power[i] * (r_ptr->speed * 2 - 110) / 100;
1774 if (r_ptr->speed < 110)
1775 power[i] = power[i] * (r_ptr->speed - 20) / 100;
1777 power[i] = power[i] * (num_taisei*2+5) / 10;
1778 else if (r_ptr->flags6 & RF6_INVULNER)
1779 power[i] = power[i] * 4 / 3;
1780 else if (r_ptr->flags6 & RF6_HEAL)
1781 power[i] = power[i] * 4 / 3;
1782 else if (r_ptr->flags5 & RF5_DRAIN_MANA)
1783 power[i] = power[i] * 11 / 10;
1784 if (r_ptr->flags1 & RF1_RAND_25)
1785 power[i] = power[i] * 9 / 10;
1786 if (r_ptr->flags1 & RF1_RAND_50)
1787 power[i] = power[i] * 9 / 10;
1789 switch (battle_mon[i])
1800 case MON_UND_BEHOLDER:
1801 case MON_SANTACLAUS:
1802 case MON_ULT_BEHOLDER:
1804 case MON_ATLACH_NACHA:
1806 power[i] = power[i] * 3 / 5;
1808 case MON_ROBIN_HOOD:
1812 case MON_CRYPT_THING:
1813 case MON_MASTER_LICH:
1814 case MON_DREADMASTER:
1816 case MON_SHADOWLORD:
1821 case MON_VENOM_WYRM:
1822 case MON_MASTER_MYS:
1823 case MON_G_MASTER_MYS:
1824 power[i] = power[i] * 3 / 4;
1826 case MON_VORPAL_BUNNY:
1829 case MON_LOG_MASTER:
1831 case MON_GRAV_HOUND:
1834 case MON_CLUB_DEMON:
1836 case MON_NIGHTCRAWLER:
1837 case MON_NIGHTWALKER:
1843 case MON_SPECT_WYRM:
1848 power[i] = power[i] * 4 / 3;
1850 case MON_UMBER_HULK:
1854 case MON_ENERGY_VOR:
1858 case MON_PLASMA_VOR:
1863 case MON_STORMBRINGER:
1864 case MON_TIME_HOUND:
1865 case MON_PLASMA_HOUND:
1868 case MON_AETHER_VOR:
1869 case MON_AETHER_HOUND:
1877 case MON_D_ELF_SHADE:
1878 case MON_MANA_HOUND:
1880 case MON_BANORLUPART:
1885 power[i] = power[i] * 3 / 2;
1889 case MON_CYBER_KING:
1890 case MON_UNICORN_ORD:
1891 power[i] = power[i] * 5 / 3;
1895 case MON_WYRM_POWER:
1915 power[i] = total*60/power[i];
1916 if (tekitou && ((power[i] < 160) || power[i] > 1500)) break;
1917 if ((power[i] < 160) && randint0(20)) break;
1918 if (power[i] < 101) power[i] = 100 + randint1(5);
1919 mon_odds[i] = power[i];
1925 static bool kakutoujou(void)
1929 char out_val[160], tmp_str[80];
1932 if ((turn - old_battle) > TURNS_PER_TICK*250)
1944 msg_print("¤ª¤¤¡ª¤ª¤Þ¤¨°ìʸ¤Ê¤·¤¸¤ã¤Ê¤¤¤«¡ª¤³¤Ã¤«¤é½Ð¤Æ¤¤¤±¡ª");
1946 msg_print("Hey! You don't have gold - get out of here!");
1960 prt("¥â¥ó¥¹¥¿¡¼ ÇÜΨ", 4, 4);
1962 prt("Monsters Odds", 4, 4);
1967 monster_race *r_ptr = &r_info[battle_mon[i]];
1970 sprintf(buf,"%d) %-58s %4ld.%02ldÇÜ", i+1, format("%s%s",r_name + r_ptr->name, (r_ptr->flags1 & RF1_UNIQUE) ? "¤â¤É¤" : " "), (long int)mon_odds[i]/100, (long int)mon_odds[i]%100);
1972 sprintf(buf,"%d) %-58s %4ld.%02ld", i+1, format("%s%s", (r_ptr->flags1 & RF1_UNIQUE) ? "Fake " : "", r_name + r_ptr->name), (long int)mon_odds[i]/100, (long int)mon_odds[i]%100);
1978 prt("¤É¤ì¤ËÅÒ¤±¤Þ¤¹¤«:", 0, 0);
1980 prt("Which monster: ", 0, 0);
1991 if (i >= '1' && i <= '4')
1993 sel_monster = i-'1';
1994 battle_odds = mon_odds[sel_monster];
2002 if (i !=sel_monster) clear_bldg(i+5,i+5);
2004 maxbet = p_ptr->lev * 200;
2006 /* We can't bet more than we have */
2007 maxbet = MIN(maxbet, p_ptr->au);
2010 strcpy(out_val, "");
2012 sprintf(tmp_str,"ÅÒ¤±¶â (1-%ld)¡©", (long int)maxbet);
2014 sprintf(tmp_str,"Your wager (1-%ld) ? ", (long int)maxbet);
2019 * Use get_string() because we may need more than
2020 * the s16b value returned by get_quantity().
2022 if (get_string(tmp_str, out_val, 32))
2025 for (p = out_val; *p == ' '; p++);
2030 if (wager > p_ptr->au)
2033 msg_print("¤ª¤¤¡ª¶â¤¬Â¤ê¤Ê¤¤¤¸¤ã¤Ê¤¤¤«¡ª½Ð¤Æ¤¤¤±¡ª");
2035 msg_print("Hey! You don't have the gold - get out of here!");
2042 else if (wager > maxbet)
2045 msg_format("%ld¥´¡¼¥ë¥É¤À¤±¼õ¤±¤è¤¦¡£»Ä¤ê¤Ï¼è¤Ã¤È¤¤Ê¡£", (long int)maxbet);
2047 msg_format("I'll take %ld gold of that. Keep the rest.",(long int) maxbet);
2055 msg_print("£Ï£Ë¡¢£±¥´¡¼¥ë¥É¤Ç¤¤¤³¤¦¡£");
2057 msg_print("Ok, we'll start with 1 gold.");
2064 battle_odds = MAX(wager+1, wager * battle_odds / 100);
2069 /* Save the surface floor as saved floor */
2070 prepare_change_floor_mode(CFM_SAVE_FLOORS);
2072 p_ptr->inside_battle = TRUE;
2073 p_ptr->leaving = TRUE;
2086 static void today_target(void)
2089 monster_race *r_ptr = &r_info[today_mon];
2093 c_put_str(TERM_YELLOW, "ËÜÆü¤Î¾Þ¶â¼ó", 5, 10);
2095 prt("Wanted monster that changes from day to day", 5, 10);
2098 sprintf(buf,"¥¿¡¼¥²¥Ã¥È¡§ %s",r_name + r_ptr->name);
2100 sprintf(buf,"target: %s",r_name + r_ptr->name);
2102 c_put_str(TERM_YELLOW, buf, 6, 10);
2104 sprintf(buf,"»àÂÎ ---- $%d",r_ptr->level * 50 + 100);
2106 sprintf(buf,"corpse ---- $%d",r_ptr->level * 50 + 100);
2110 sprintf(buf,"¹ü ---- $%d",r_ptr->level * 30 + 60);
2112 sprintf(buf,"skeleton ---- $%d",r_ptr->level * 30 + 60);
2115 p_ptr->today_mon = today_mon;
2118 static void tsuchinoko(void)
2122 c_put_str(TERM_YELLOW, "°ì³ÍÀé¶â¤ÎÂç¥Á¥ã¥ó¥¹¡ª¡ª¡ª", 5, 10);
2123 c_put_str(TERM_YELLOW, "¥¿¡¼¥²¥Ã¥È¡§¸¸¤ÎÄÁ½Ã¡Ö¥Ä¥Á¥Î¥³¡×", 6, 10);
2124 c_put_str(TERM_WHITE, "À¸¤±Êá¤ê ---- $1,000,000", 8, 10);
2125 c_put_str(TERM_WHITE, "»àÂÎ ---- $200,000", 9, 10);
2126 c_put_str(TERM_WHITE, "¹ü ---- $100,000", 10, 10);
2128 c_put_str(TERM_YELLOW, "Big chance to quick money!!!", 5, 10);
2129 c_put_str(TERM_YELLOW, "target: the rarest animal 'Tsuchinoko'", 6, 10);
2130 c_put_str(TERM_WHITE, "catch alive ---- $1,000,000", 8, 10);
2131 c_put_str(TERM_WHITE, "corpse ---- $200,000", 9, 10);
2132 c_put_str(TERM_WHITE, "bones ---- $100,000", 10, 10);
2136 static void shoukinkubi(void)
2144 prt("»àÂΤò»ý¤Áµ¢¤ì¤ÐÊó½·¤òº¹¤·¾å¤²¤Þ¤¹¡£",4 ,10);
2145 c_put_str(TERM_YELLOW, "¸½ºß¤Î¾Þ¶â¼ó", 6, 10);
2147 prt("Offer a prize when you bring a wanted monster's corpse",4 ,10);
2148 c_put_str(TERM_YELLOW, "Wanted monsters", 6, 10);
2151 for (i = 0; i < MAX_KUBI; i++)
2155 monster_race *r_ptr = &r_info[(kubi_r_idx[i] > 10000 ? kubi_r_idx[i] - 10000 : kubi_r_idx[i])];
2157 if (kubi_r_idx[i] > 10000)
2163 done_mark = "(done)";
2172 c_prt(color, format("%s %s", r_name + r_ptr->name, done_mark), y+7, 10);
2175 if (!y && (i < MAX_KUBI -1))
2178 prt("²¿¤«¥¡¼¤ò²¡¤·¤Æ¤¯¤À¤µ¤¤", 0, 0);
2180 prt("Hit any key.", 0, 0);
2190 /* List of prize object */
2194 } prize_list[MAX_KUBI] =
2196 {TV_POTION, SV_POTION_CURING},
2197 {TV_POTION, SV_POTION_SPEED},
2198 {TV_POTION, SV_POTION_SPEED},
2199 {TV_POTION, SV_POTION_RESISTANCE},
2200 {TV_POTION, SV_POTION_ENLIGHTENMENT},
2202 {TV_POTION, SV_POTION_HEALING},
2203 {TV_POTION, SV_POTION_RESTORE_MANA},
2204 {TV_SCROLL, SV_SCROLL_STAR_DESTRUCTION},
2205 {TV_POTION, SV_POTION_STAR_ENLIGHTENMENT},
2206 {TV_SCROLL, SV_SCROLL_SUMMON_PET},
2208 {TV_SCROLL, SV_SCROLL_GENOCIDE},
2209 {TV_POTION, SV_POTION_STAR_HEALING},
2210 {TV_POTION, SV_POTION_STAR_HEALING},
2211 {TV_POTION, SV_POTION_NEW_LIFE},
2212 {TV_SCROLL, SV_SCROLL_MASS_GENOCIDE},
2214 {TV_POTION, SV_POTION_LIFE},
2215 {TV_POTION, SV_POTION_LIFE},
2216 {TV_POTION, SV_POTION_AUGMENTATION},
2217 {TV_POTION, SV_POTION_INVULNERABILITY},
2218 {TV_SCROLL, SV_SCROLL_ARTIFACT},
2223 static bool kankin(void)
2226 bool change = FALSE;
2227 char o_name[MAX_NLEN];
2230 /* Loop for inventory and right/left arm */
2231 for (i = 0; i <= INVEN_LARM; i++)
2233 o_ptr = &inventory[i];
2235 /* Living Tsuchinoko worthes $1000000 */
2236 if ((o_ptr->tval == TV_CAPTURE) && (o_ptr->pval == MON_TSUCHINOKO))
2238 char buf[MAX_NLEN+20];
2239 object_desc(o_name, o_ptr, 0);
2241 sprintf(buf, "%s ¤ò´¹¶â¤·¤Þ¤¹¤«¡©",o_name);
2243 sprintf(buf, "Convert %s into money? ",o_name);
2248 msg_format("¾Þ¶â %ld¡ð¤ò¼ê¤ËÆþ¤ì¤¿¡£", (long int)(1000000L * o_ptr->number));
2250 msg_format("You get %ldgp.", (long int)(1000000L * o_ptr->number));
2252 p_ptr->au += 1000000L * o_ptr->number;
2253 p_ptr->redraw |= (PR_GOLD);
2254 inven_item_increase(i, -o_ptr->number);
2255 inven_item_describe(i);
2256 inven_item_optimize(i);
2262 for (i = 0; i < INVEN_PACK; i++)
2264 o_ptr = &inventory[i];
2266 /* Corpse of Tsuchinoko worthes $200000 */
2267 if ((o_ptr->tval == TV_CORPSE) && (o_ptr->sval == SV_CORPSE) && (o_ptr->pval == MON_TSUCHINOKO))
2269 char buf[MAX_NLEN+20];
2270 object_desc(o_name, o_ptr, 0);
2272 sprintf(buf, "%s ¤ò´¹¶â¤·¤Þ¤¹¤«¡©",o_name);
2274 sprintf(buf, "Convert %s into money? ",o_name);
2279 msg_format("¾Þ¶â %ld¡ð¤ò¼ê¤ËÆþ¤ì¤¿¡£", (long int)(200000L * o_ptr->number));
2281 msg_format("You get %ldgp.", (long int)(200000L * o_ptr->number));
2283 p_ptr->au += 200000L * o_ptr->number;
2284 p_ptr->redraw |= (PR_GOLD);
2285 inven_item_increase(i, -o_ptr->number);
2286 inven_item_describe(i);
2287 inven_item_optimize(i);
2293 for (i = 0; i < INVEN_PACK; i++)
2295 o_ptr = &inventory[i];
2297 /* Bones of Tsuchinoko worthes $100000 */
2298 if ((o_ptr->tval == TV_CORPSE) && (o_ptr->sval == SV_SKELETON) && (o_ptr->pval == MON_TSUCHINOKO))
2300 char buf[MAX_NLEN+20];
2301 object_desc(o_name, o_ptr, 0);
2303 sprintf(buf, "%s ¤ò´¹¶â¤·¤Þ¤¹¤«¡©",o_name);
2305 sprintf(buf, "Convert %s into money? ",o_name);
2310 msg_format("¾Þ¶â %ld¡ð¤ò¼ê¤ËÆþ¤ì¤¿¡£", (long int)(100000L * o_ptr->number));
2312 msg_format("You get %ldgp.", (long int)(100000L * o_ptr->number));
2314 p_ptr->au += 100000L * o_ptr->number;
2315 p_ptr->redraw |= (PR_GOLD);
2316 inven_item_increase(i, -o_ptr->number);
2317 inven_item_describe(i);
2318 inven_item_optimize(i);
2324 for (i = 0; i < INVEN_PACK; i++)
2326 o_ptr = &inventory[i];
2327 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)))
2329 char buf[MAX_NLEN+20];
2330 object_desc(o_name, o_ptr, 0);
2332 sprintf(buf, "%s ¤ò´¹¶â¤·¤Þ¤¹¤«¡©",o_name);
2334 sprintf(buf, "Convert %s into money? ",o_name);
2339 msg_format("¾Þ¶â %ld¡ð¤ò¼ê¤ËÆþ¤ì¤¿¡£", (long int)((r_info[today_mon].level * 50 + 100) * o_ptr->number));
2341 msg_format("You get %ldgp.", (long int)((r_info[today_mon].level * 50 + 100) * o_ptr->number));
2343 p_ptr->au += (r_info[today_mon].level * 50 + 100) * o_ptr->number;
2344 p_ptr->redraw |= (PR_GOLD);
2345 inven_item_increase(i, -o_ptr->number);
2346 inven_item_describe(i);
2347 inven_item_optimize(i);
2353 for (i = 0; i < INVEN_PACK; i++)
2355 o_ptr = &inventory[i];
2357 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)))
2359 char buf[MAX_NLEN+20];
2360 object_desc(o_name, o_ptr, 0);
2362 sprintf(buf, "%s ¤ò´¹¶â¤·¤Þ¤¹¤«¡©",o_name);
2364 sprintf(buf, "Convert %s into money? ",o_name);
2369 msg_format("¾Þ¶â %ld¡ð¤ò¼ê¤ËÆþ¤ì¤¿¡£", (long int)((r_info[today_mon].level * 30 + 60) * o_ptr->number));
2371 msg_format("You get %ldgp.", (long int)((r_info[today_mon].level * 30 + 60) * o_ptr->number));
2373 p_ptr->au += (r_info[today_mon].level * 30 + 60) * o_ptr->number;
2374 p_ptr->redraw |= (PR_GOLD);
2375 inven_item_increase(i, -o_ptr->number);
2376 inven_item_describe(i);
2377 inven_item_optimize(i);
2383 for (j = 0; j < MAX_KUBI; j++)
2385 /* Need reverse order --- Positions will be changed in the loop */
2386 for (i = INVEN_PACK-1; i >= 0; i--)
2388 o_ptr = &inventory[i];
2389 if ((o_ptr->tval == TV_CORPSE) && (o_ptr->pval == kubi_r_idx[j]))
2391 char buf[MAX_NLEN+20];
2392 int num, k, item_new;
2395 object_desc(o_name, o_ptr, 0);
2397 sprintf(buf, "%s¤òÅϤ·¤Þ¤¹¤«¡©",o_name);
2399 sprintf(buf, "Hand %s over? ",o_name);
2401 if (!get_check(buf)) continue;
2403 #if 0 /* Obsoleted */
2405 msg_format("¾Þ¶â %ld¡ð¤ò¼ê¤ËÆþ¤ì¤¿¡£", (r_info[kubi_r_idx[j]].level + 1) * 300 * o_ptr->number);
2407 msg_format("You get %ldgp.", (r_info[kubi_r_idx[j]].level + 1) * 300 * o_ptr->number);
2409 p_ptr->au += (r_info[kubi_r_idx[j]].level+1) * 300 * o_ptr->number;
2410 p_ptr->redraw |= (PR_GOLD);
2411 inven_item_increase(i, -o_ptr->number);
2412 inven_item_describe(i);
2413 inven_item_optimize(i);
2414 chg_virtue(V_JUSTICE, 5);
2415 kubi_r_idx[j] += 10000;
2418 #endif /* Obsoleted */
2421 inven_item_increase(i, -o_ptr->number);
2422 inven_item_describe(i);
2423 inven_item_optimize(i);
2425 chg_virtue(V_JUSTICE, 5);
2426 kubi_r_idx[j] += 10000;
2428 /* Count number of unique corpses already handed */
2429 for (num = 0, k = 0; k < MAX_KUBI; k++)
2431 if (kubi_r_idx[k] >= 10000) num++;
2435 msg_format("¤³¤ì¤Ç¹ç·× %d ¥Ý¥¤¥ó¥È³ÍÆÀ¤·¤Þ¤·¤¿¡£", num);
2437 msg_format("You earned %d point%s total.", num, (num > 1 ? "s" : ""));
2440 /* Prepare to make a prize */
2441 object_prep(&forge, lookup_kind(prize_list[num-1].tval, prize_list[num-1].sval));
2442 apply_magic(&forge, object_level, AM_NO_FIXED_ART);
2444 /* Identify it fully */
2445 object_aware(&forge);
2446 object_known(&forge);
2449 * Hand it --- Assume there is an empty slot.
2450 * Since a corpse is handed at first,
2451 * there is at least one empty slot.
2453 item_new = inven_carry(&forge);
2455 /* Describe the object */
2456 object_desc(o_name, &forge, 0);
2458 msg_format("%s(%c)¤òÌã¤Ã¤¿¡£", o_name, index_to_label(item_new));
2460 msg_format("You get %s (%c). ", o_name, index_to_label(item_new));
2463 /* Auto-inscription */
2464 autopick_alter_item(item_new, FALSE);
2477 msg_print("¾Þ¶â¤òÆÀ¤é¤ì¤½¤¦¤Ê¤â¤Î¤Ï»ý¤Ã¤Æ¤¤¤Ê¤«¤Ã¤¿¡£");
2479 msg_print("You have nothing.");
2487 bool get_nightmare(int r_idx)
2489 monster_race *r_ptr = &r_info[r_idx];
2491 /* Require eldritch horrors */
2492 if (!(r_ptr->flags2 & (RF2_ELDRITCH_HORROR))) return (FALSE);
2494 /* Require high level */
2495 if (r_ptr->level <= p_ptr->lev) return (FALSE);
2497 /* Accept this monster */
2502 void have_nightmare(int r_idx)
2504 bool happened = FALSE;
2505 monster_race *r_ptr = &r_info[r_idx];
2506 int power = r_ptr->level + 10;
2508 cptr desc = r_name + r_ptr->name;
2512 if (!(r_ptr->flags1 & RF1_UNIQUE))
2513 sprintf(m_name, "%s %s", (is_a_vowel(desc[0]) ? "an" : "a"), desc);
2516 sprintf(m_name, "%s", desc);
2518 if (!(r_ptr->flags1 & RF1_UNIQUE))
2520 if (r_ptr->flags1 & RF1_FRIENDS) power /= 2;
2524 if (saving_throw(p_ptr->skill_sav * 100 / power))
2527 msg_format("Ì´¤ÎÃæ¤Ç%s¤ËÄɤ¤¤«¤±¤é¤ì¤¿¡£", m_name);
2529 msg_format("%^s chases you through your dreams.", m_name);
2538 /* Something silly happens... */
2540 msg_format("%s%s¤Î´é¤ò¸«¤Æ¤·¤Þ¤Ã¤¿¡ª",
2542 msg_format("You behold the %s visage of %s!",
2545 funny_desc[randint0(MAX_SAN_FUNNY)], m_name);
2549 msg_print(funny_comments[randint0(MAX_SAN_COMMENT)]);
2550 p_ptr->image = p_ptr->image + randint1(r_ptr->level);
2553 /* Never mind; we can't see it clearly enough */
2557 /* Something frightening happens... */
2559 msg_format("%s%s¤Î´é¤ò¸«¤Æ¤·¤Þ¤Ã¤¿¡ª",
2561 msg_format("You behold the %s visage of %s!",
2564 horror_desc[randint0(MAX_SAN_HORROR)], desc);
2566 r_ptr->r_flags2 |= RF2_ELDRITCH_HORROR;
2568 if (!p_ptr->mimic_form)
2570 switch (p_ptr->prace)
2572 /* Demons may make a saving throw */
2575 if (saving_throw(20 + p_ptr->lev)) return;
2577 /* Undead may make a saving throw */
2582 if (saving_throw(10 + p_ptr->lev)) return;
2588 /* Demons may make a saving throw */
2589 if (mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_DEMON)
2591 if (saving_throw(20 + p_ptr->lev)) return;
2593 /* Undead may make a saving throw */
2594 else if (mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_UNDEAD)
2596 if (saving_throw(10 + p_ptr->lev)) return;
2601 if (!saving_throw(p_ptr->skill_sav * 100 / power))
2603 if (!p_ptr->resist_conf)
2605 (void)set_confused(p_ptr->confused + randint0(4) + 4);
2607 if (!p_ptr->resist_chaos && one_in_(3))
2609 (void)set_image(p_ptr->image + randint0(250) + 150);
2614 /* Lose int & wis */
2615 if (!saving_throw(p_ptr->skill_sav * 100 / power))
2623 if (!saving_throw(p_ptr->skill_sav * 100 / power))
2625 if (!p_ptr->resist_conf)
2627 (void)set_confused(p_ptr->confused + randint0(4) + 4);
2629 if (!p_ptr->free_act)
2631 (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
2633 while (!saving_throw(p_ptr->skill_sav))
2635 (void)do_dec_stat(A_INT);
2637 while (!saving_throw(p_ptr->skill_sav))
2639 (void)do_dec_stat(A_WIS);
2641 if (!p_ptr->resist_chaos)
2643 (void)set_image(p_ptr->image + randint0(250) + 150);
2650 if (!saving_throw(p_ptr->skill_sav * 100 / power))
2652 if (lose_all_info())
2655 msg_print("¤¢¤Þ¤ê¤Î¶²ÉݤËÁ´¤Æ¤Î¤³¤È¤ò˺¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª");
2657 msg_print("You forget everything in your utmost terror!");
2664 /* Else gain permanent insanity */
2665 if ((p_ptr->muta3 & MUT3_MORONIC) && (p_ptr->muta2 & MUT2_BERS_RAGE) &&
2666 ((p_ptr->muta2 & MUT2_COWARDICE) || (p_ptr->resist_fear)) &&
2667 ((p_ptr->muta2 & MUT2_HALLU) || (p_ptr->resist_chaos)))
2669 /* The poor bastard already has all possible insanities! */
2675 switch (randint1(4))
2679 if (!(p_ptr->muta3 & MUT3_MORONIC))
2681 if ((p_ptr->stat_use[A_INT] < 4) && (p_ptr->stat_use[A_WIS] < 4))
2684 msg_print("¤¢¤Ê¤¿¤Ï´°àú¤ÊÇϼ¯¤Ë¤Ê¤Ã¤¿¤è¤¦¤Êµ¤¤¬¤·¤¿¡£¤·¤«¤·¤½¤ì¤Ï¸µ¡¹¤À¤Ã¤¿¡£");
2686 msg_print("You turn into an utter moron!");
2692 msg_print("¤¢¤Ê¤¿¤Ï´°àú¤ÊÇϼ¯¤Ë¤Ê¤Ã¤¿¡ª");
2694 msg_print("You turn into an utter moron!");
2698 if (p_ptr->muta3 & MUT3_HYPER_INT)
2701 msg_print("¤¢¤Ê¤¿¤ÎǾ¤ÏÀ¸ÂÎ¥³¥ó¥Ô¥å¡¼¥¿¤Ç¤Ï¤Ê¤¯¤Ê¤Ã¤¿¡£");
2703 msg_print("Your brain is no longer a living computer.");
2706 p_ptr->muta3 &= ~(MUT3_HYPER_INT);
2708 p_ptr->muta3 |= MUT3_MORONIC;
2715 if (!(p_ptr->muta2 & MUT2_COWARDICE) && !p_ptr->resist_fear)
2718 msg_print("¤¢¤Ê¤¿¤Ï¥Ñ¥é¥Î¥¤¥¢¤Ë¤Ê¤Ã¤¿¡ª");
2720 msg_print("You become paranoid!");
2724 /* Duh, the following should never happen, but anyway... */
2725 if (p_ptr->muta3 & MUT3_FEARLESS)
2728 msg_print("¤¢¤Ê¤¿¤Ï¤â¤¦¶²¤ìÃΤ餺¤Ç¤Ï¤Ê¤¯¤Ê¤Ã¤¿¡£");
2730 msg_print("You are no longer fearless.");
2733 p_ptr->muta3 &= ~(MUT3_FEARLESS);
2736 p_ptr->muta2 |= MUT2_COWARDICE;
2743 if (!(p_ptr->muta2 & MUT2_HALLU) && !p_ptr->resist_chaos)
2746 msg_print("¸¸³Ð¤ò¤Ò¤µ¯¤³¤¹Àº¿ÀºøÍð¤Ë´Ù¤Ã¤¿¡ª");
2748 msg_print("You are afflicted by a hallucinatory insanity!");
2751 p_ptr->muta2 |= MUT2_HALLU;
2758 if (!(p_ptr->muta2 & MUT2_BERS_RAGE))
2761 msg_print("·ãÎõ¤Ê´¶¾ð¤Îȯºî¤Ë¤ª¤½¤ï¤ì¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¡ª");
2763 msg_print("You become subject to fits of berserk rage!");
2766 p_ptr->muta2 |= MUT2_BERS_RAGE;
2774 p_ptr->update |= PU_BONUS;
2781 * Note that resting for the night was a perfect way to avoid player
2782 * ghosts in the town *if* you could only make it to the inn in time (-:
2783 * Now that the ghosts are temporarily disabled in 2.8.X, this function
2784 * will not be that useful. I will keep it in the hopes the player
2785 * ghost code does become a reality again. Does help to avoid filthy urchins.
2786 * Resting at night is also a quick way to restock stores -KMW-
2788 static bool inn_comm(int cmd)
2792 case BACT_FOOD: /* Buy food & drink */
2793 if (p_ptr->food >= PY_FOOD_FULL)
2796 msg_print("º£¤ÏËþÊ¢¤À¡£");
2798 msg_print("You are full now.");
2804 msg_print("¥Ð¡¼¥Æ¥ó¤Ï¤¤¤¯¤é¤«¤Î¿©¤Ùʪ¤È¥Ó¡¼¥ë¤ò¤¯¤ì¤¿¡£");
2806 msg_print("The barkeep gives you some gruel and a beer.");
2809 (void)set_food(PY_FOOD_MAX - 1);
2812 case BACT_REST: /* Rest for the night */
2813 if ((p_ptr->poisoned) || (p_ptr->cut))
2816 msg_print("¤¢¤Ê¤¿¤ËɬÍפʤΤÏÉô²°¤Ç¤Ï¤Ê¤¯¡¢¼£ÎżԤǤ¹¡£");
2818 msg_print("You need a healer, not a room.");
2823 msg_print("¤¹¤ß¤Þ¤»¤ó¡¢¤Ç¤â¤¦¤Á¤Ç狼¤Ë»à¤Ê¤ì¤Á¤ãº¤¤ê¤Þ¤¹¤ó¤Ç¡£");
2825 msg_print("Sorry, but don't want anyone dying in here.");
2830 s32b oldturn = turn;
2831 int prev_day, prev_hour, prev_min;
2833 extract_day_hour_min(&prev_day, &prev_hour, &prev_min);
2835 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "½É²°¤ËÇñ¤Þ¤Ã¤¿¡£");
2837 if ((prev_hour >= 6) && (prev_hour <= 17)) do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "stay over daytime at the inn.");
2838 else do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "stay over night at the inn.");
2840 turn = (turn / (TURNS_PER_TICK*TOWN_DAWN/2) + 1) * (TURNS_PER_TICK*TOWN_DAWN/2);
2841 if (dungeon_turn < dungeon_turn_limit)
2843 dungeon_turn += MIN(turn - oldturn, TURNS_PER_TICK * 250);
2844 if (dungeon_turn > dungeon_turn_limit) dungeon_turn = dungeon_turn_limit;
2847 prevent_turn_overflow();
2849 if ((prev_hour >= 18) && (prev_hour <= 23)) do_cmd_write_nikki(NIKKI_HIGAWARI, 0, NULL);
2850 p_ptr->chp = p_ptr->mhp;
2852 if (ironman_nightmare)
2855 msg_print("̲¤ê¤Ë½¢¤¯¤È¶²¤í¤·¤¤¸÷·Ê¤¬¿´¤ò¤è¤®¤Ã¤¿¡£");
2857 msg_print("Horrible visions flit through your mind as you sleep.");
2860 /* Pick a nightmare */
2861 get_mon_num_prep(get_nightmare, NULL);
2863 /* Have some nightmares */
2866 have_nightmare(get_mon_num(MAX_DEPTH));
2868 if (!one_in_(3)) break;
2871 /* Remove the monster restriction */
2872 get_mon_num_prep(NULL, NULL);
2875 msg_print("¤¢¤Ê¤¿¤ÏÀ䶫¤·¤ÆÌܤò³Ð¤Þ¤·¤¿¡£");
2876 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "°Ì´¤Ë¤¦¤Ê¤µ¤ì¤Æ¤è¤¯Ì²¤ì¤Ê¤«¤Ã¤¿¡£");
2878 msg_print("You awake screaming.");
2879 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "be troubled by a nightmare.");
2887 p_ptr->chp = p_ptr->mhp;
2888 p_ptr->csp = p_ptr->msp;
2889 if (p_ptr->pclass == CLASS_MAGIC_EATER)
2892 for (i = 0; i < 72; i++)
2894 p_ptr->magic_num1[i] = p_ptr->magic_num2[i]*EATER_CHARGE;
2896 for (; i < 108; i++)
2898 p_ptr->magic_num1[i] = 0;
2902 if ((prev_hour >= 6) && (prev_hour <= 17))
2905 msg_print("¤¢¤Ê¤¿¤Ï¥ê¥Õ¥ì¥Ã¥·¥å¤·¤ÆÌܳФᡢͼÊý¤ò·Þ¤¨¤¿¡£");
2906 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "ͼÊý¤ò·Þ¤¨¤¿¡£");
2908 msg_print("You awake refreshed for the evening.");
2909 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "awake refreshed.");
2915 msg_print("¤¢¤Ê¤¿¤Ï¥ê¥Õ¥ì¥Ã¥·¥å¤·¤ÆÌܳФᡢ¿·¤¿¤ÊÆü¤ò·Þ¤¨¤¿¡£");
2916 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "¤¹¤¬¤¹¤¬¤·¤¤Ä«¤ò·Þ¤¨¤¿¡£");
2918 msg_print("You awake refreshed for the new day.");
2919 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "awake refreshed.");
2926 case BACT_RUMORS: /* Listen for rumors */
2931 if (!get_rnd_line_jonly("rumors_j.txt", 0, Rumor, 10))
2933 if (!get_rnd_line("rumors.txt", 0, Rumor))
2936 msg_format("%s", Rumor);
2946 * Display quest information
2948 static void get_questinfo(int questnum)
2955 /* Clear the text */
2956 for (i = 0; i < 10; i++)
2958 quest_text[i][0] = '\0';
2961 quest_text_line = 0;
2963 /* Set the quest number temporary */
2964 old_quest = p_ptr->inside_quest;
2965 p_ptr->inside_quest = questnum;
2967 /* Get the quest text */
2968 init_flags = INIT_SHOW_TEXT | INIT_ASSIGN;
2970 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
2972 /* Reset the old quest number */
2973 p_ptr->inside_quest = old_quest;
2975 /* Print the quest info */
2977 sprintf(tmp_str, "¥¯¥¨¥¹¥È¾ðÊó (´í¸±ÅÙ: %d ³¬ÁêÅö)", quest[questnum].level);
2979 sprintf(tmp_str, "Quest Information (Danger level: %d)", quest[questnum].level);
2984 prt(quest[questnum].name, 7, 0);
2986 for (i = 0; i < 10; i++)
2988 c_put_str(TERM_YELLOW, quest_text[i], i + 8, 0);
2994 * Request a quest from the Lord.
2996 static void castle_quest(void)
2999 monster_race *r_ptr;
3006 /* Current quest of the building */
3007 q_index = cave[py][px].special;
3009 /* Is there a quest available at the building? */
3013 put_str("º£¤Î¤È¤³¤í¥¯¥¨¥¹¥È¤Ï¤¢¤ê¤Þ¤»¤ó¡£", 8, 0);
3015 put_str("I don't have a quest for you at the moment.", 8, 0);
3021 q_ptr = &quest[q_index];
3023 /* Quest is completed */
3024 if (q_ptr->status == QUEST_STATUS_COMPLETED)
3026 /* Rewarded quest */
3027 q_ptr->status = QUEST_STATUS_REWARDED;
3029 get_questinfo(q_index);
3031 reinit_wilderness = TRUE;
3034 else if (q_ptr->status == QUEST_STATUS_FAILED)
3036 get_questinfo(q_index);
3038 /* Mark quest as done (but failed) */
3039 q_ptr->status = QUEST_STATUS_FAILED_DONE;
3041 reinit_wilderness = TRUE;
3043 /* Quest is still unfinished */
3044 else if (q_ptr->status == QUEST_STATUS_TAKEN)
3047 put_str("¤¢¤Ê¤¿¤Ï¸½ºß¤Î¥¯¥¨¥¹¥È¤ò½ªÎ»¤µ¤»¤Æ¤¤¤Þ¤»¤ó¡ª", 8, 0);
3049 put_str("You have not completed your current quest yet!", 8, 0);
3053 put_str("CTRL-Q¤ò»È¤¨¤Ð¥¯¥¨¥¹¥È¤Î¾õÂÖ¤¬¥Á¥§¥Ã¥¯¤Ç¤¤Þ¤¹¡£", 9, 0);
3055 put_str("Use CTRL-Q to check the status of your quest.", 9, 0);
3059 put_str("¥¯¥¨¥¹¥È¤ò½ª¤ï¤é¤»¤¿¤éÌá¤Ã¤ÆÍè¤Æ²¼¤µ¤¤¡£", 12, 0);
3061 put_str("Return when you have completed your quest.", 12, 0);
3066 else if (q_ptr->status == QUEST_STATUS_UNTAKEN)
3068 q_ptr->status = QUEST_STATUS_TAKEN;
3070 reinit_wilderness = TRUE;
3072 /* Assign a new quest */
3073 if (q_ptr->type == QUEST_TYPE_KILL_ANY_LEVEL)
3075 if (q_ptr->r_idx == 0)
3077 /* Random monster at least 5 - 10 levels out of deep */
3078 q_ptr->r_idx = get_mon_num(q_ptr->level + 4 + randint1(6));
3081 r_ptr = &r_info[q_ptr->r_idx];
3083 while ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->rarity != 1))
3085 q_ptr->r_idx = get_mon_num(q_ptr->level) + 4 + randint1(6);
3086 r_ptr = &r_info[q_ptr->r_idx];
3089 if (q_ptr->max_num == 0)
3091 /* Random monster number */
3092 if (randint1(10) > 7)
3095 q_ptr->max_num = randint1(3) + 1;
3099 name = (r_name + r_ptr->name);
3101 msg_format("¥¯¥¨¥¹¥È: %s¤ò %dÂÎÅݤ¹", name,q_ptr->max_num);
3103 msg_format("Your quest: kill %d %s", q_ptr->max_num, name);
3109 get_questinfo(q_index);
3116 * Display town history
3118 static void town_history(void)
3123 /* Peruse the building help file */
3125 (void)show_file(TRUE, "jbldg.txt", NULL, 0, 0);
3127 (void)show_file(TRUE, "bldg.txt", NULL, 0, 0);
3137 * Display the damage figure of an object
3138 * (used by compare_weapon_aux1)
3140 * Only accurate for the current weapon, because it includes
3141 * the current +dam of the player.
3143 static void compare_weapon_aux2(object_type *o_ptr, int numblows,
3144 int r, int c, int mult, cptr attr,
3149 /* Effective dices */
3150 int eff_dd = o_ptr->dd + p_ptr->to_dd[0];
3151 int eff_ds = o_ptr->ds + p_ptr->to_ds[0];
3153 /* Print the intro text */
3154 c_put_str(color, attr, r, c);
3156 /* Calculate the min and max damage figures */
3158 sprintf(tmp_str, "£±¥¿¡¼¥ó: %d-%d ¥À¥á¡¼¥¸",
3160 sprintf(tmp_str, "Attack: %d-%d damage",
3163 (numblows * (mult * eff_dd / 60 + o_ptr->to_d + p_ptr->to_d[0])),
3164 (numblows * (mult * eff_ds * eff_dd / 60 + o_ptr->to_d + p_ptr->to_d[0])));
3166 /* Print the damage */
3167 put_str(tmp_str, r, c + 8);
3172 * Show the damage figures for the various monster types
3174 * Only accurate for the current weapon, because it includes
3175 * the current number of blows for the player.
3177 static void compare_weapon_aux1(object_type *o_ptr, int col, int r)
3180 u32b flgs[TR_FLAG_SIZE];
3181 int blow = p_ptr->num_blow[0];
3182 bool print_force_weapon = FALSE;
3184 /* Get the flags of the weapon */
3185 object_flags(o_ptr, flgs);
3187 if ((p_ptr->pclass != CLASS_SAMURAI) && have_flag(flgs, TR_FORCE_WEAPON) && (p_ptr->csp > (o_ptr->dd * o_ptr->ds / 5)))
3189 mult = mult * 7 / 2;
3190 print_force_weapon = TRUE;
3193 /* Print the relevant lines */
3195 if (print_force_weapon) compare_weapon_aux2(o_ptr, blow, r++, col, 1*mult, "ÍýÎÏ:", TERM_L_BLUE);
3196 if (have_flag(flgs, TR_KILL_ANIMAL)) compare_weapon_aux2(o_ptr, blow, r++, col, 4*mult, "ưʪ:", TERM_YELLOW);
3197 else if (have_flag(flgs, TR_SLAY_ANIMAL)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "ưʪ:", TERM_YELLOW);
3198 if (have_flag(flgs, TR_KILL_EVIL)) compare_weapon_aux2(o_ptr, blow, r++, col, 7*mult/2, "¼Ù°:", TERM_YELLOW);
3199 else if (have_flag(flgs, TR_SLAY_EVIL)) compare_weapon_aux2(o_ptr, blow, r++, col, 2*mult, "¼Ù°:", TERM_YELLOW);
3200 if (have_flag(flgs, TR_KILL_HUMAN)) compare_weapon_aux2(o_ptr, blow, r++, col, 4*mult, "¿Í´Ö:", TERM_YELLOW);
3201 else if (have_flag(flgs, TR_SLAY_HUMAN)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "¿Í´Ö:", TERM_YELLOW);
3202 if (have_flag(flgs, TR_KILL_UNDEAD)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "ÉÔ»à:", TERM_YELLOW);
3203 else if (have_flag(flgs, TR_SLAY_UNDEAD)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "ÉÔ»à:", TERM_YELLOW);
3204 if (have_flag(flgs, TR_KILL_DEMON)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "°Ëâ:", TERM_YELLOW);
3205 else if (have_flag(flgs, TR_SLAY_DEMON)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "°Ëâ:", TERM_YELLOW);
3206 if (have_flag(flgs, TR_KILL_ORC)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "¥ª¡¼¥¯:", TERM_YELLOW);
3207 else if (have_flag(flgs, TR_SLAY_ORC)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "¥ª¡¼¥¯:", TERM_YELLOW);
3208 if (have_flag(flgs, TR_KILL_TROLL)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "¥È¥í¥ë:", TERM_YELLOW);
3209 else if (have_flag(flgs, TR_SLAY_TROLL)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "¥È¥í¥ë:", TERM_YELLOW);
3210 if (have_flag(flgs, TR_KILL_GIANT)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "µð¿Í:", TERM_YELLOW);
3211 else if (have_flag(flgs, TR_SLAY_GIANT)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "µð¿Í:", TERM_YELLOW);
3212 if (have_flag(flgs, TR_KILL_DRAGON)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "ε:", TERM_YELLOW);
3213 else if (have_flag(flgs, TR_SLAY_DRAGON)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "ε:", TERM_YELLOW);
3214 if (have_flag(flgs, TR_BRAND_ACID)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "»À°À:", TERM_RED);
3215 if (have_flag(flgs, TR_BRAND_ELEC)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "ÅÅ°À:", TERM_RED);
3216 if (have_flag(flgs, TR_BRAND_FIRE)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "±ê°À:", TERM_RED);
3217 if (have_flag(flgs, TR_BRAND_COLD)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "Îä°À:", TERM_RED);
3218 if (have_flag(flgs, TR_BRAND_POIS)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "ÆÇ°À:", TERM_RED);
3220 if (print_force_weapon) compare_weapon_aux2(o_ptr, blow, r++, col, 1*mult, "Force :", TERM_L_BLUE);
3221 if (have_flag(flgs, TR_KILL_ANIMAL)) compare_weapon_aux2(o_ptr, blow, r++, col, 4*mult, "Animals:", TERM_YELLOW);
3222 else if (have_flag(flgs, TR_SLAY_ANIMAL)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "Animals:", TERM_YELLOW);
3223 if (have_flag(flgs, TR_KILL_EVIL)) compare_weapon_aux2(o_ptr, blow, r++, col, 7*mult/2, "Evil:", TERM_YELLOW);
3224 else if (have_flag(flgs, TR_SLAY_EVIL)) compare_weapon_aux2(o_ptr, blow, r++, col, 2*mult, "Evil:", TERM_YELLOW);
3225 if (have_flag(flgs, TR_KILL_HUMAN)) compare_weapon_aux2(o_ptr, blow, r++, col, 4*mult, "Human:", TERM_YELLOW);
3226 else if (have_flag(flgs, TR_SLAY_HUMAN)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "Human:", TERM_YELLOW);
3227 if (have_flag(flgs, TR_KILL_UNDEAD)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "Undead:", TERM_YELLOW);
3228 else if (have_flag(flgs, TR_SLAY_UNDEAD)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "Undead:", TERM_YELLOW);
3229 if (have_flag(flgs, TR_KILL_DEMON)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "Demons:", TERM_YELLOW);
3230 else if (have_flag(flgs, TR_SLAY_DEMON)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "Demons:", TERM_YELLOW);
3231 if (have_flag(flgs, TR_KILL_ORC)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "Orcs:", TERM_YELLOW);
3232 else if (have_flag(flgs, TR_SLAY_ORC)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "Orcs:", TERM_YELLOW);
3233 if (have_flag(flgs, TR_KILL_TROLL)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "Trolls:", TERM_YELLOW);
3234 else if (have_flag(flgs, TR_SLAY_TROLL)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "Trolls:", TERM_YELLOW);
3235 if (have_flag(flgs, TR_KILL_GIANT)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "Giants:", TERM_YELLOW);
3236 else if (have_flag(flgs, TR_SLAY_GIANT)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "Giants:", TERM_YELLOW);
3237 if (have_flag(flgs, TR_KILL_DRAGON)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "Dragons:", TERM_YELLOW);
3238 else if (have_flag(flgs, TR_SLAY_DRAGON)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "Dragons:", TERM_YELLOW);
3239 if (have_flag(flgs, TR_BRAND_ACID)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "Acid:", TERM_RED);
3240 if (have_flag(flgs, TR_BRAND_ELEC)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "Elec:", TERM_RED);
3241 if (have_flag(flgs, TR_BRAND_FIRE)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "Fire:", TERM_RED);
3242 if (have_flag(flgs, TR_BRAND_COLD)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "Cold:", TERM_RED);
3243 if (have_flag(flgs, TR_BRAND_POIS)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "Poison:", TERM_RED);
3248 static int hit_chance(int to_h, int ac)
3251 int meichuu = p_ptr->skill_thn + (p_ptr->to_h[0] + to_h) * BTH_PLUS_ADJ;
3253 if (meichuu <= 0) return 5;
3255 chance = 100 - ((ac * 75) / meichuu);
3257 if (chance > 95) chance = 95;
3258 if (chance < 5) chance = 5;
3259 if (p_ptr->pseikaku == SEIKAKU_NAMAKE)
3260 chance = (chance*19+9)/20;
3265 * Displays all info about a weapon
3267 * Only accurate for the current weapon, because it includes
3268 * various info about the player's +to_dam and number of blows.
3270 static void list_weapon(object_type *o_ptr, int row, int col)
3272 char o_name[MAX_NLEN];
3275 /* Effective dices */
3276 int eff_dd = o_ptr->dd + p_ptr->to_dd[0];
3277 int eff_ds = o_ptr->ds + p_ptr->to_ds[0];
3279 /* Print the weapon name */
3280 object_desc(o_name, o_ptr, OD_NAME_ONLY);
3281 c_put_str(TERM_YELLOW, o_name, row, col);
3283 /* Print the player's number of blows */
3285 sprintf(tmp_str, "¹¶·â²ó¿ô: %d", p_ptr->num_blow[0]);
3287 sprintf(tmp_str, "Number of Blows: %d", p_ptr->num_blow[0]);
3290 put_str(tmp_str, row+1, col);
3292 /* Print to_hit and to_dam of the weapon */
3294 sprintf(tmp_str, "Ì¿ÃæΨ: 0 50 100 150 200 (Ũ¤ÎAC)");
3296 sprintf(tmp_str, "To Hit: 0 50 100 150 200 (AC)");
3299 put_str(tmp_str, row+2, col);
3301 /* Print the weapons base damage dice */
3303 sprintf(tmp_str, " %2d %2d %2d %2d %2d (%%)", hit_chance(o_ptr->to_h, 0), hit_chance(o_ptr->to_h, 50), hit_chance(o_ptr->to_h, 100), hit_chance(o_ptr->to_h, 150), hit_chance(o_ptr->to_h, 200));
3305 sprintf(tmp_str, " %2d %2d %2d %2d %2d (%%)", hit_chance(o_ptr->to_h, 0), hit_chance(o_ptr->to_h, 50), hit_chance(o_ptr->to_h, 100), hit_chance(o_ptr->to_h, 150), hit_chance(o_ptr->to_h, 200));
3308 put_str(tmp_str, row+3, col);
3311 c_put_str(TERM_YELLOW, "²Äǽ¤Ê¥À¥á¡¼¥¸:", row+5, col);
3313 c_put_str(TERM_YELLOW, "Possible Damage:", row+5, col);
3317 /* Damage for one blow (if it hits) */
3319 sprintf(tmp_str, "¹¶·â°ì²ó¤Ë¤Ä¤ %d-%d",
3321 sprintf(tmp_str, "One Strike: %d-%d damage",
3324 eff_dd + o_ptr->to_d + p_ptr->to_d[0],
3325 eff_ds * eff_dd + o_ptr->to_d + p_ptr->to_d[0]);
3326 put_str(tmp_str, row+6, col+1);
3328 /* Damage for the complete attack (if all blows hit) */
3330 sprintf(tmp_str, "£±¥¿¡¼¥ó¤Ë¤Ä¤ %d-%d",
3332 sprintf(tmp_str, "One Attack: %d-%d damage",
3335 p_ptr->num_blow[0] * (eff_dd + o_ptr->to_d + p_ptr->to_d[0]),
3336 p_ptr->num_blow[0] * (eff_ds * eff_dd + o_ptr->to_d + p_ptr->to_d[0]));
3337 put_str(tmp_str, row+7, col+1);
3342 * Hook to specify "weapon"
3344 static bool item_tester_hook_melee_weapon(object_type *o_ptr)
3346 switch (o_ptr->tval)
3356 if (o_ptr->sval != SV_DOKUBARI) return (TRUE);
3365 * Hook to specify "ammo"
3367 static bool item_tester_hook_ammo(object_type *o_ptr)
3369 switch (o_ptr->tval)
3386 * Copies the weapons to compare into the weapon-slot and
3387 * compares the values for both weapons.
3389 static bool compare_weapons(void)
3392 object_type *o1_ptr, *o2_ptr;
3393 object_type orig_weapon;
3397 bool old_character_xtra = character_xtra;
3400 /* Clear the screen */
3403 /* Store copy of original wielded weapon */
3404 i_ptr = &inventory[INVEN_RARM];
3405 object_copy(&orig_weapon, i_ptr);
3407 item_tester_no_ryoute = TRUE;
3408 /* Only compare melee weapons */
3409 item_tester_hook = item_tester_hook_melee_weapon;
3411 /* Get the first weapon */
3413 q = "Âè°ì¤ÎÉð´ï¤Ï¡©";
3414 s = "Èæ¤Ù¤ë¤â¤Î¤¬¤¢¤ê¤Þ¤»¤ó¡£";
3416 q = "What is your first weapon? ";
3417 s = "You have nothing to compare.";
3420 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN)))
3426 /* Get the item (in the pack) */
3427 o1_ptr = &inventory[item];
3429 /* Clear the screen */
3432 item_tester_no_ryoute = TRUE;
3433 /* Only compare melee weapons */
3434 item_tester_hook = item_tester_hook_melee_weapon;
3436 /* Get the second weapon */
3438 q = "ÂèÆó¤ÎÉð´ï¤Ï¡©";
3439 s = "Èæ¤Ù¤ë¤â¤Î¤¬¤¢¤ê¤Þ¤»¤ó¡£";
3441 q = "What is your second weapon? ";
3442 s = "You have nothing to compare.";
3445 if (!get_item(&item2, q, s, (USE_EQUIP | USE_INVEN)))
3451 /* Get the item (in the pack) */
3452 o2_ptr = &inventory[item2];
3454 /* Clear the screen */
3457 /* Copy first weapon into the weapon slot (if it's not already there) */
3458 if (o1_ptr != i_ptr)
3459 object_copy(i_ptr, o1_ptr);
3461 /* Hack -- prevent "icky" message */
3462 character_xtra = TRUE;
3464 /* Get the new values */
3467 character_xtra = old_character_xtra;
3469 /* List the new values */
3470 list_weapon(o1_ptr, row, 2);
3471 compare_weapon_aux1(o1_ptr, 2, row + 8);
3473 /* Copy second weapon into the weapon slot (if it's not already there) */
3474 if (o2_ptr != i_ptr)
3475 object_copy(i_ptr, o2_ptr);
3477 object_copy(i_ptr, &orig_weapon);
3479 /* Hack -- prevent "icky" message */
3480 character_xtra = TRUE;
3482 /* Get the new values */
3485 character_xtra = old_character_xtra;
3487 /* List the new values */
3488 list_weapon(o2_ptr, row, 40);
3489 compare_weapon_aux1(o2_ptr, 40, row + 8);
3491 /* Copy back the original weapon into the weapon slot */
3492 object_copy(i_ptr, &orig_weapon);
3494 /* Reset the values for the old weapon */
3498 put_str("(°ìÈֹ⤤¥À¥á¡¼¥¸¤¬Å¬ÍѤµ¤ì¤Þ¤¹¡£Ê£¿ô¤ÎÇÜÂǸú²Ì¤Ï¤·»»¤µ¤ì¤Þ¤»¤ó¡£)", row + 4, 0);
3500 put_str("(Only highest damage applies per monster. Special damage not cumulative.)", row + 4, 0);
3504 msg_print("¸½ºß¤Îµ»Î̤«¤éȽÃǤ¹¤ë¤È¡¢¤¢¤Ê¤¿¤ÎÉð´ï¤Ï°Ê²¼¤Î¤è¤¦¤Ê°ÒÎϤòȯ´ø¤·¤Þ¤¹:");
3506 msg_print("Based on your current abilities, here is what your weapons will do");
3522 * AC¤«¤é²óÈòΨ¡¢¥À¥á¡¼¥¸¸º¾¯Î¨¤ò·×»»¤·É½¼¨¤¹¤ë
3523 * Calculate and display the dodge-rate and the protection-rate
3526 static bool eval_ac(int iAC)
3530 "¥À¥á¡¼¥¸·Ú¸ºÎ¨¤È¤Ï¡¢Å¨¤Î¹¶·â¤¬Åö¤¿¤Ã¤¿»þ¤½¤Î¥À¥á¡¼¥¸¤ò\n"
3531 "²¿¥Ñ¡¼¥»¥ó¥È·Ú¸º¤¹¤ë¤«¤ò¼¨¤·¤Þ¤¹¡£\n"
3532 "¥À¥á¡¼¥¸·Ú¸º¤ÏÄ̾ï¤ÎľÀܹ¶·â(¼ïÎब¡Ö¹¶·â¤¹¤ë¡×¤È¡ÖÊ´ºÕ¤¹¤ë¡×¤Îʪ)\n"
3533 "¤ËÂФ·¤Æ¤Î¤ß¸ú²Ì¤¬¤¢¤ê¤Þ¤¹¡£\n \n"
3534 "Ũ¤Î¥ì¥Ù¥ë¤È¤Ï¡¢¤½¤ÎŨ¤¬Ä̾ﲿ³¬¤Ë¸½¤ì¤ë¤«¤ò¼¨¤·¤Þ¤¹¡£\n \n"
3535 "²óÈòΨ¤ÏŨ¤ÎľÀܹ¶·â¤ò²¿¥Ñ¡¼¥»¥ó¥È¤Î³ÎΨ¤ÇÈò¤±¤ë¤«¤ò¼¨¤·¡¢\n"
3536 "Ũ¤Î¥ì¥Ù¥ë¤È¤¢¤Ê¤¿¤ÎAC¤Ë¤è¤Ã¤Æ·èÄꤵ¤ì¤Þ¤¹¡£\n \n"
3537 "¥À¥á¡¼¥¸´üÂÔÃͤȤϡ¢Å¨¤Î£±£°£°¥Ý¥¤¥ó¥È¤ÎÄ̾ﹶ·â¤ËÂФ·¡¢\n"
3538 "²óÈòΨ¤È¥À¥á¡¼¥¸·Ú¸ºÎ¨¤ò¹Íθ¤·¤¿¥À¥á¡¼¥¸¤Î´üÂÔÃͤò¼¨¤·¤Þ¤¹¡£\n";
3541 "'Protection Rate' means how much damage is reduced by your armor.\n"
3542 "Note that the Protection rate is effective only against normal "
3543 "'attack' and 'shatter' type melee attacks, "
3544 "and has no effect against any other types such as 'poison'.\n \n"
3545 "'Dodge Rate' indicates the success rate on dodging the "
3546 "monster's melee attacks. "
3547 "It is depend on the level of the monster and your AC.\n \n"
3548 "'Average Damage' indicates the expected amount of damage "
3549 "when you are attacked by normal melee attacks with power=100.";
3555 char buf[80*20], *t;
3557 /* AC lower than zero has no effect */
3558 if (iAC < 0) iAC = 0;
3560 /* ¥À¥á¡¼¥¸·Ú¸ºÎ¨¤ò·×»» */
3561 protection = 100 * MIN(iAC, 150) / 250;
3567 put_str(format("¤¢¤Ê¤¿¤Î¸½ºß¤ÎAC: %3d", iAC), row++, 0);
3568 put_str(format("¥À¥á¡¼¥¸·Ú¸ºÎ¨ : %3d%%", protection), row++, 0);
3571 put_str("Ũ¤Î¥ì¥Ù¥ë :", row + 0, 0);
3572 put_str("²óÈòΨ :", row + 1, 0);
3573 put_str("¥À¥á¡¼¥¸´üÂÔÃÍ :", row + 2, 0);
3575 put_str(format("Your current AC : %3d", iAC), row++, 0);
3576 put_str(format("Protection rate : %3d%%", protection), row++, 0);
3579 put_str("Level of Monster:", row + 0, 0);
3580 put_str("Dodge Rate :", row + 1, 0);
3581 put_str("Average Damage :", row + 2, 0);
3584 for (col = 17 + 1, lvl = 0; lvl <= 100; lvl += 10, col += 5)
3586 int quality = 60 + lvl * 3; /* attack quality with power 60 */
3587 int dodge; /* ²óÈòΨ(%) */
3588 int average; /* ¥À¥á¡¼¥¸´üÂÔÃÍ */
3590 put_str(format("%3d", lvl), row + 0, col);
3593 dodge = 5 + (MIN(100, 100 * (iAC * 3 / 4) / quality) * 9 + 5) / 10;
3594 put_str(format("%3d%%", dodge), row + 1, col);
3596 /* 100ÅÀ¤Î¹¶·â¤ËÂФ·¤Æ¤Î¥À¥á¡¼¥¸´üÂÔÃͤò·×»» */
3597 average = (100 - dodge) * (100 - protection) / 100;
3598 put_str(format("%3d", average), row + 2, col);
3602 roff_to_buf(memo, 70, buf, sizeof(buf));
3603 for (t = buf; t[0]; t += strlen(t) + 1)
3604 put_str(t, (row++) + 4, 4);
3607 prt("¸½ºß¤Î¤¢¤Ê¤¿¤ÎÁõÈ÷¤«¤é¤¹¤ë¤È¡¢¤¢¤Ê¤¿¤ÎËɸæÎϤÏ"
3608 "¤³¤ì¤¯¤é¤¤¤Ç¤¹:", 0, 0);
3610 prt("Defense abilities from your current Armor Class are evaluated below.", 0, 0);
3625 static bool enchant_item(int cost, int to_hit, int to_dam, int to_ac)
3631 int maxenchant = (p_ptr->lev / 5);
3632 char tmp_str[MAX_NLEN];
3636 prt(format("¸½ºß¤Î¤¢¤Ê¤¿¤Îµ»Î̤À¤È¡¢+%d ¤Þ¤Ç²þÎɤǤ¤Þ¤¹¡£", maxenchant), 5, 0);
3637 prt(format(" ²þÎɤÎÎÁ¶â¤Ï°ì¸Ä¤Ë¤Ä¤¡ð%d ¤Ç¤¹¡£", cost), 7, 0);
3639 prt(format(" Based on your skill, we can improve up to +%d.", maxenchant), 5, 0);
3640 prt(format(" The price for the service is %d gold per item.", cost), 7, 0);
3643 item_tester_no_ryoute = TRUE;
3647 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò²þÎɤ·¤Þ¤¹¤«¡©";
3648 s = "²þÎɤǤ¤ë¤â¤Î¤¬¤¢¤ê¤Þ¤»¤ó¡£";
3650 q = "Improve which item? ";
3651 s = "You have nothing to improve.";
3654 if (!get_item(&item, q, s, (USE_INVEN | USE_EQUIP))) return (FALSE);
3656 /* Get the item (in the pack) */
3657 o_ptr = &inventory[item];
3659 /* Check if the player has enough money */
3660 if (p_ptr->au < (cost * o_ptr->number))
3662 object_desc(tmp_str, o_ptr, OD_NAME_ONLY);
3664 msg_format("%s¤ò²þÎɤ¹¤ë¤À¤±¤Î¥´¡¼¥ë¥É¤¬¤¢¤ê¤Þ¤»¤ó¡ª", tmp_str);
3666 msg_format("You do not have the gold to improve %s!", tmp_str);
3672 /* Enchant to hit */
3673 for (i = 0; i < to_hit; i++)
3675 if (o_ptr->to_h < maxenchant)
3677 if (enchant(o_ptr, 1, (ENCH_TOHIT | ENCH_FORCE)))
3685 /* Enchant to damage */
3686 for (i = 0; i < to_dam; i++)
3688 if (o_ptr->to_d < maxenchant)
3690 if (enchant(o_ptr, 1, (ENCH_TODAM | ENCH_FORCE)))
3699 for (i = 0; i < to_ac; i++)
3701 if (o_ptr->to_a < maxenchant)
3703 if (enchant(o_ptr, 1, (ENCH_TOAC | ENCH_FORCE)))
3715 if (flush_failure) flush();
3719 msg_print("²þÎɤ˼ºÇÔ¤·¤¿¡£");
3721 msg_print("The improvement failed.");
3728 object_desc(tmp_str, o_ptr, OD_NAME_AND_ENCHANT);
3730 msg_format("¡ð%d¤Ç%s¤Ë²þÎɤ·¤Þ¤·¤¿¡£", cost * o_ptr->number, tmp_str);
3732 msg_format("Improved into %s for %d gold.", tmp_str, cost * o_ptr->number);
3735 /* Charge the money */
3736 p_ptr->au -= (cost * o_ptr->number);
3738 if (item >= INVEN_RARM) calc_android_exp();
3740 /* Something happened */
3747 * Recharge rods, wands and staves
3749 * The player can select the number of charges to add
3750 * (up to a limit), and the recharge never fails.
3752 * The cost for rods depends on the level of the rod. The prices
3753 * for recharging wands and staves are dependent on the cost of
3756 static void building_recharge(void)
3765 char tmp_str[MAX_NLEN];
3769 /* Display some info */
3772 prt(" ºÆ½¼Å¶¤ÎÈñÍѤϥ¢¥¤¥Æ¥à¤Î¼ïÎà¤Ë¤è¤ê¤Þ¤¹¡£", 6, 0);
3774 prt(" The prices of recharge depend on the type.", 6, 0);
3778 /* Only accept legal items */
3779 item_tester_hook = item_tester_hook_recharge;
3783 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ËËâÎϤò½¼Å¶¤·¤Þ¤¹¤«? ";
3784 s = "ËâÎϤò½¼Å¶¤¹¤Ù¤¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡£";
3786 q = "Recharge which item? ";
3787 s = "You have nothing to recharge.";
3790 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
3792 /* Get the item (in the pack) */
3795 o_ptr = &inventory[item];
3798 /* Get the item (on the floor) */
3801 o_ptr = &o_list[0 - item];
3804 k_ptr = &k_info[o_ptr->k_idx];
3807 * We don't want to give the player free info about
3808 * the level of the item or the number of charges.
3810 /* The item must be "known" */
3811 if (!object_is_known(o_ptr))
3814 msg_format("½¼Å¶¤¹¤ëÁ°¤Ë´ÕÄꤵ¤ì¤Æ¤¤¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡ª");
3816 msg_format("The item must be identified first!");
3821 if ((p_ptr->au >= 50) &&
3823 get_check("¡ð50¤Ç´ÕÄꤷ¤Þ¤¹¤«¡© "))
3825 get_check("Identify for 50 gold? "))
3833 identify_item(o_ptr);
3836 object_desc(tmp_str, o_ptr, 0);
3839 msg_format("%s ¤Ç¤¹¡£", tmp_str);
3841 msg_format("You have: %s.", tmp_str);
3844 /* Auto-inscription */
3845 autopick_alter_item(item, FALSE);
3847 /* Update the gold display */
3848 building_prt_gold();
3856 /* Extract the object "level" */
3857 lev = k_info[o_ptr->k_idx].level;
3859 /* Price for a rod */
3860 if (o_ptr->tval == TV_ROD)
3862 if (o_ptr->timeout > 0)
3864 /* Fully recharge */
3865 price = (lev * 50 * o_ptr->timeout) / k_ptr->pval;
3869 /* No recharge necessary */
3872 msg_format("¤½¤ì¤ÏºÆ½¼Å¶¤¹¤ëɬÍפϤ¢¤ê¤Þ¤»¤ó¡£");
3874 msg_format("That doesn't need to be recharged.");
3880 else if (o_ptr->tval == TV_STAFF)
3882 /* Price per charge ( = double the price paid by shopkeepers for the charge) */
3883 price = (k_info[o_ptr->k_idx].cost / 10) * o_ptr->number;
3885 /* Pay at least 10 gold per charge */
3886 price = MAX(10, price);
3890 /* Price per charge ( = double the price paid by shopkeepers for the charge) */
3891 price = (k_info[o_ptr->k_idx].cost / 10);
3893 /* Pay at least 10 gold per charge */
3894 price = MAX(10, price);
3897 /* Limit the number of charges for wands and staffs */
3898 if (o_ptr->tval == TV_WAND
3899 && (o_ptr->pval / o_ptr->number >= k_ptr->pval))
3901 if (o_ptr->number > 1)
3904 msg_print("¤³¤ÎËâË¡ËÀ¤Ï¤â¤¦½¼Ê¬¤Ë½¼Å¶¤µ¤ì¤Æ¤¤¤Þ¤¹¡£");
3906 msg_print("These wands are already fully charged.");
3912 msg_print("¤³¤ÎËâË¡ËÀ¤Ï¤â¤¦½¼Ê¬¤Ë½¼Å¶¤µ¤ì¤Æ¤¤¤Þ¤¹¡£");
3914 msg_print("This wand is already fully charged.");
3919 else if (o_ptr->tval == TV_STAFF && o_ptr->pval >= k_ptr->pval)
3921 if (o_ptr->number > 1)
3924 msg_print("¤³¤Î¾ó¤Ï¤â¤¦½¼Ê¬¤Ë½¼Å¶¤µ¤ì¤Æ¤¤¤Þ¤¹¡£");
3926 msg_print("These staffs are already fully charged.");
3932 msg_print("¤³¤Î¾ó¤Ï¤â¤¦½¼Ê¬¤Ë½¼Å¶¤µ¤ì¤Æ¤¤¤Þ¤¹¡£");
3934 msg_print("This staff is already fully charged.");
3940 /* Check if the player has enough money */
3941 if (p_ptr->au < price)
3943 object_desc(tmp_str, o_ptr, OD_NAME_ONLY);
3945 msg_format("%s¤òºÆ½¼Å¶¤¹¤ë¤Ë¤Ï¡ð%d ɬÍפǤ¹¡ª", tmp_str,price );
3947 msg_format("You need %d gold to recharge %s!", price, tmp_str);
3953 if (o_ptr->tval == TV_ROD)
3956 if (get_check(format("¤½¤Î¥í¥Ã¥É¤ò¡ð%d ¤ÇºÆ½¼Å¶¤·¤Þ¤¹¤«¡©",
3959 if (get_check(format("Recharge the %s for %d gold? ",
3960 ((o_ptr->number > 1) ? "rods" : "rod"), price)))
3964 /* Recharge fully */
3974 if (o_ptr->tval == TV_STAFF)
3975 max_charges = k_ptr->pval - o_ptr->pval;
3977 max_charges = o_ptr->number * k_ptr->pval - o_ptr->pval;
3979 /* Get the quantity for staves and wands */
3981 charges = get_quantity(format("°ì²óʬ¡ð%d ¤Ç²¿²óʬ½¼Å¶¤·¤Þ¤¹¤«¡©",
3983 charges = get_quantity(format("Add how many charges for %d gold? ",
3986 price), MIN(p_ptr->au / price, max_charges));
3989 if (charges < 1) return;
3991 /* Get the new price */
3995 o_ptr->pval += charges;
3997 /* We no longer think the item is empty */
3998 o_ptr->ident &= ~(IDENT_EMPTY);
4002 object_desc(tmp_str, o_ptr, 0);
4004 msg_format("%s¤ò¡ð%d ¤ÇºÆ½¼Å¶¤·¤Þ¤·¤¿¡£", tmp_str, price);
4006 msg_format("%^s %s recharged for %d gold.", tmp_str, ((o_ptr->number > 1) ? "were" : "was"), price);
4009 /* Combine / Reorder the pack (later) */
4010 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
4013 p_ptr->window |= (PW_INVEN);
4024 * Recharge rods, wands and staves
4026 * The player can select the number of charges to add
4027 * (up to a limit), and the recharge never fails.
4029 * The cost for rods depends on the level of the rod. The prices
4030 * for recharging wands and staves are dependent on the cost of
4033 static void building_recharge_all(void)
4043 /* Display some info */
4047 prt(" ºÆ½¼Å¶¤ÎÈñÍѤϥ¢¥¤¥Æ¥à¤Î¼ïÎà¤Ë¤è¤ê¤Þ¤¹¡£", 6, 0);
4049 prt(" The prices of recharge depend on the type.", 6, 0);
4052 /* Calculate cost */
4053 for ( i = 0; i < INVEN_PACK; i++)
4055 o_ptr = &inventory[i];
4057 /* skip non magic device */
4058 if (o_ptr->tval < TV_STAFF || o_ptr->tval > TV_ROD) continue;
4060 /* need identified */
4061 if (!object_is_known(o_ptr)) total_cost += 50;
4063 /* Extract the object "level" */
4064 lev = k_info[o_ptr->k_idx].level;
4066 k_ptr = &k_info[o_ptr->k_idx];
4068 switch (o_ptr->tval)
4071 price = (lev * 50 * o_ptr->timeout) / k_ptr->pval;
4075 /* Price per charge ( = double the price paid by shopkeepers for the charge) */
4076 price = (k_info[o_ptr->k_idx].cost / 10) * o_ptr->number;
4078 /* Pay at least 10 gold per charge */
4079 price = MAX(10, price);
4082 price = (k_ptr->pval - o_ptr->pval) * price;
4086 /* Price per charge ( = double the price paid by shopkeepers for the charge) */
4087 price = (k_info[o_ptr->k_idx].cost / 10);
4089 /* Pay at least 10 gold per charge */
4090 price = MAX(10, price);
4093 price = (o_ptr->number * k_ptr->pval - o_ptr->pval) * price;
4097 /* if price <= 0 then item have enough charge */
4098 if (price > 0) total_cost += price;
4104 msg_print("½¼Å¶¤¹¤ëɬÍפϤ¢¤ê¤Þ¤»¤ó¡£");
4106 msg_print("No need to recharge.");
4113 /* Check if the player has enough money */
4114 if (p_ptr->au < total_cost)
4117 msg_format("¤¹¤Ù¤Æ¤Î¥¢¥¤¥Æ¥à¤òºÆ½¼Å¶¤¹¤ë¤Ë¤Ï¡ð%d ɬÍפǤ¹¡ª", total_cost );
4119 msg_format("You need %d gold to recharge all items!",total_cost);
4127 if (!get_check(format("¤¹¤Ù¤Æ¤Î¥¢¥¤¥Æ¥à¤ò ¡ð%d ¤ÇºÆ½¼Å¶¤·¤Þ¤¹¤«¡©", total_cost))) return;
4129 if (!get_check(format("Recharge all items for %d gold? ", total_cost))) return;
4132 for (i = 0; i < INVEN_PACK; i++)
4134 o_ptr = &inventory[i];
4135 k_ptr = &k_info[o_ptr->k_idx];
4137 /* skip non magic device */
4138 if (o_ptr->tval < TV_STAFF || o_ptr->tval > TV_ROD) continue;
4141 if (!object_is_known(o_ptr))
4143 identify_item(o_ptr);
4145 /* Auto-inscription */
4146 autopick_alter_item(i, FALSE);
4150 switch (o_ptr->tval)
4156 if (o_ptr->pval < k_ptr->pval) o_ptr->pval = k_ptr->pval;
4157 /* We no longer think the item is empty */
4158 o_ptr->ident &= ~(IDENT_EMPTY);
4161 if (o_ptr->pval < o_ptr->number * k_ptr->pval)
4162 o_ptr->pval = o_ptr->number * k_ptr->pval;
4163 /* We no longer think the item is empty */
4164 o_ptr->ident &= ~(IDENT_EMPTY);
4171 msg_format("¡ð%d ¤ÇºÆ½¼Å¶¤·¤Þ¤·¤¿¡£", total_cost);
4173 msg_format("You pay %d gold.", total_cost);
4178 /* Combine / Reorder the pack (later) */
4179 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
4182 p_ptr->window |= (PW_INVEN);
4185 p_ptr->au -= total_cost;
4192 bool tele_town(void)
4200 msg_print("¤³¤ÎËâË¡¤ÏÃϾå¤Ç¤·¤«»È¤¨¤Ê¤¤¡ª");
4202 msg_print("This spell can only be used on the surface!");
4207 if (p_ptr->inside_arena || p_ptr->inside_battle)
4210 msg_print("¤³¤ÎËâË¡¤Ï³°¤Ç¤·¤«»È¤¨¤Ê¤¤¡ª");
4212 msg_print("This spell can only be used outside!");
4220 for (i=1;i<max_towns;i++)
4224 if ((i == NO_TOWN) || (i == SECRET_TOWN) || (i == p_ptr->town_num) || !(p_ptr->visit & (1L << (i-1)))) continue;
4226 sprintf(buf,"%c) %-20s", I2A(i-1), town[i].name);
4234 msg_print("¤Þ¤À¹Ô¤±¤ë¤È¤³¤í¤¬¤Ê¤¤¡£");
4236 msg_print("You have not yet visited any town.");
4245 prt("¤É¤³¤Ë¹Ô¤¤Þ¤¹¤«:", 0, 0);
4247 prt("Which town you go: ", 0, 0);
4258 else if ((i < 'a') || (i > ('a'+max_towns-2))) continue;
4259 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;
4263 for (y = 0; y < max_wild_y; y++)
4265 for (x = 0; x < max_wild_x; x++)
4267 if(wilderness[y][x].town == (i-'a'+1))
4269 p_ptr->wilderness_y = y;
4270 p_ptr->wilderness_x = x;
4275 p_ptr->leaving = TRUE;
4277 p_ptr->teleport_town = TRUE;
4287 static bool research_mon(void)
4295 bool recall = FALSE;
4301 /* XTRA HACK WHATSEARCH */
4307 /* XTRA HACK REMEMBER_IDX */
4308 static int old_sym = '\0';
4309 static int old_i = 0;
4312 /* Save the screen */
4315 /* Get a character, or abort */
4317 if (!get_com("¥â¥ó¥¹¥¿¡¼¤Îʸ»ú¤òÆþÎϤ·¤Æ²¼¤µ¤¤(µ¹æ or ^AÁ´,^U¥æ,^NÈó¥æ,^M̾Á°):", &sym, FALSE))
4319 if (!get_com("Enter character to be identified(^A:All,^U:Uniqs,^N:Non uniqs,^M:Name): ", &sym, FALSE))
4329 /* Find that character info, and describe it */
4330 for (i = 0; ident_info[i]; ++i)
4332 if (sym == ident_info[i][0]) break;
4335 /* XTRA HACK WHATSEARCH */
4336 if (sym == KTRL('A'))
4340 strcpy(buf, "Á´¥â¥ó¥¹¥¿¡¼¤Î¥ê¥¹¥È");
4342 strcpy(buf, "Full monster list.");
4345 else if (sym == KTRL('U'))
4349 strcpy(buf, "¥æ¥Ë¡¼¥¯¡¦¥â¥ó¥¹¥¿¡¼¤Î¥ê¥¹¥È");
4351 strcpy(buf, "Unique monster list.");
4354 else if (sym == KTRL('N'))
4358 strcpy(buf, "¥æ¥Ë¡¼¥¯³°¥â¥ó¥¹¥¿¡¼¤Î¥ê¥¹¥È");
4360 strcpy(buf, "Non-unique monster list.");
4363 else if (sym == KTRL('M'))
4367 if (!get_string("̾Á°(±Ñ¸ì¤Î¾ì¹ç¾®Ê¸»ú¤Ç²Ä)",temp, 70))
4369 if (!get_string("Enter name:",temp, 70))
4380 sprintf(buf, "̾Á°:%s¤Ë¥Þ¥Ã¥Á",temp);
4382 sprintf(buf, "Monsters with a name \"%s\"",temp);
4385 else if (ident_info[i])
4387 sprintf(buf, "%c - %s.", sym, ident_info[i] + 2);
4392 sprintf(buf, "%c - %s", sym, "̵¸ú¤Êʸ»ú");
4394 sprintf(buf, "%c - %s.", sym, "Unknown Symbol");
4399 /* Display the result */
4403 /* Allocate the "who" array */
4404 C_MAKE(who, max_r_idx, u16b);
4406 /* Collect matching monsters */
4407 for (n = 0, i = 1; i < max_r_idx; i++)
4409 monster_race *r_ptr = &r_info[i];
4412 if (!r_ptr->name) continue;
4414 /* XTRA HACK WHATSEARCH */
4415 /* Require non-unique monsters if needed */
4416 if (norm && (r_ptr->flags1 & (RF1_UNIQUE))) continue;
4418 /* Require unique monsters if needed */
4419 if (uniq && !(r_ptr->flags1 & (RF1_UNIQUE))) continue;
4427 for (xx = 0; temp[xx] && xx < 80; xx++)
4430 if (iskanji(temp[xx]))
4436 if (isupper(temp[xx])) temp[xx] = tolower(temp[xx]);
4440 strcpy(temp2, r_name + r_ptr->E_name);
4442 strcpy(temp2, r_name + r_ptr->name);
4444 for (xx = 0; temp2[xx] && xx < 80; xx++)
4445 if (isupper(temp2[xx])) temp2[xx] = tolower(temp2[xx]);
4448 if (my_strstr(temp2, temp) || my_strstr(r_name + r_ptr->name, temp))
4450 if (my_strstr(temp2, temp))
4454 else if (all || (r_ptr->d_char == sym)) who[n++] = i;
4457 /* Nothing to recall */
4460 /* Free the "who" array */
4461 C_KILL(who, max_r_idx, u16b);
4473 /* Sort if needed */
4476 /* Select the sort method */
4477 ang_sort_comp = ang_sort_comp_hook;
4478 ang_sort_swap = ang_sort_swap_hook;
4480 /* Sort the array */
4481 ang_sort(who, &why, n);
4485 /* Start at the end */
4486 /* XTRA HACK REMEMBER_IDX */
4487 if (old_sym == sym && old_i < n) i = old_i;
4492 /* Scan the monster memory */
4495 /* Extract a race */
4498 /* Hack -- Begin the prompt */
4501 /* Hack -- Complete the prompt */
4503 Term_addstr(-1, TERM_WHITE, " ['r'»×¤¤½Ð, ' '¤Ç³¹Ô, ESC]");
4505 Term_addstr(-1, TERM_WHITE, " [(r)ecall, ESC, space to continue]");
4515 /*** Recall on screen ***/
4517 /* Get maximal info about this monster */
4518 lore_do_probe(r_idx);
4520 /* Save this monster ID */
4521 monster_race_track(r_idx);
4523 /* Hack -- Handle stuff */
4526 /* know every thing mode */
4527 screen_roff(r_idx, 0x01);
4530 /* XTRA HACK REMEMBER_IDX */
4538 /* Normal commands */
4539 if (query != 'r') break;
4546 if (query == ESCAPE) break;
4548 /* Move to "prev" monster */
4554 if (!expand_list) break;
4558 /* Move to "next" monster */
4564 if (!expand_list) break;
4570 /* Re-display the identity */
4571 /* prt(buf, 5, 5);*/
4573 /* Free the "who" array */
4574 C_KILL(who, max_r_idx, u16b);
4579 return (!notpicked);
4584 * Execute a building command
4586 static void bldg_process_command(building_type *bldg, int i)
4588 int bact = bldg->actions[i];
4593 /* Flush messages XXX XXX XXX */
4598 bcost = bldg->member_costs[i];
4600 bcost = bldg->other_costs[i];
4602 /* action restrictions */
4603 if (((bldg->action_restr[i] == 1) && !is_member(bldg)) ||
4604 ((bldg->action_restr[i] == 2) && !is_owner(bldg)))
4607 msg_print("¤½¤ì¤òÁªÂò¤¹¤ë¸¢Íø¤Ï¤¢¤ê¤Þ¤»¤ó¡ª");
4609 msg_print("You have no right to choose that!");
4614 /* check gold (HACK - Recharge uses variable costs) */
4615 if ((bact != BACT_RECHARGE) &&
4616 (((bldg->member_costs[i] > p_ptr->au) && is_owner(bldg)) ||
4617 ((bldg->other_costs[i] > p_ptr->au) && !is_owner(bldg))))
4620 msg_print("¤ª¶â¤¬Â¤ê¤Þ¤»¤ó¡ª");
4622 msg_print("You do not have the gold!");
4632 case BACT_RESEARCH_ITEM:
4633 paid = identify_fully(FALSE);
4635 case BACT_TOWN_HISTORY:
4638 case BACT_RACE_LEGENDS:
4644 case BACT_KING_LEGENDS:
4645 case BACT_ARENA_LEGENDS:
4650 case BACT_ARENA_RULES:
4654 case BACT_IN_BETWEEN:
4656 case BACT_SPIN_WHEEL:
4657 case BACT_DICE_SLOTS:
4658 case BACT_GAMBLE_RULES:
4665 paid = inn_comm(bact);
4667 case BACT_RESEARCH_MONSTER:
4668 paid = research_mon();
4670 case BACT_COMPARE_WEAPONS:
4671 paid = compare_weapons();
4673 case BACT_ENCHANT_WEAPON:
4674 item_tester_hook = object_allow_enchant_melee_weapon;
4675 enchant_item(bcost, 1, 1, 0);
4677 case BACT_ENCHANT_ARMOR:
4678 item_tester_hook = object_is_armour;
4679 enchant_item(bcost, 0, 0, 1);
4682 building_recharge();
4684 case BACT_RECHARGE_ALL:
4685 building_recharge_all();
4687 case BACT_IDENTS: /* needs work */
4689 if (!get_check("»ý¤Áʪ¤òÁ´¤Æ´ÕÄꤷ¤Æ¤è¤í¤·¤¤¤Ç¤¹¤«¡©")) break;
4691 msg_print(" »ý¤ÁʪÁ´¤Æ¤¬´ÕÄꤵ¤ì¤Þ¤·¤¿¡£");
4693 if (!get_check("Do you pay for identify all your possession? ")) break;
4695 msg_print("Your possessions have been identified.");
4700 case BACT_IDENT_ONE: /* needs work */
4701 paid = ident_spell(FALSE);
4706 case BACT_HEALING: /* needs work */
4715 case BACT_RESTORE: /* needs work */
4716 if (do_res_stat(A_STR)) paid = TRUE;
4717 if (do_res_stat(A_INT)) paid = TRUE;
4718 if (do_res_stat(A_WIS)) paid = TRUE;
4719 if (do_res_stat(A_DEX)) paid = TRUE;
4720 if (do_res_stat(A_CON)) paid = TRUE;
4721 if (do_res_stat(A_CHR)) paid = TRUE;
4723 case BACT_ENCHANT_ARROWS:
4724 item_tester_hook = item_tester_hook_ammo;
4725 enchant_item(bcost, 1, 1, 0);
4727 case BACT_ENCHANT_BOW:
4728 item_tester_tval = TV_BOW;
4729 enchant_item(bcost, 1, 1, 0);
4732 if (recall_player(1)) paid = TRUE;
4734 case BACT_TELEPORT_LEVEL:
4741 select_dungeon = choose_dungeon("¤Ë¥Æ¥ì¥Ý¡¼¥È", 4, 0);
4743 select_dungeon = choose_dungeon("teleport", 4, 0);
4745 show_building(bldg);
4746 if (!select_dungeon) return;
4748 max_depth = d_info[select_dungeon].maxdepth;
4750 /* Limit depth in Angband */
4751 if (select_dungeon == DUNGEON_ANGBAND)
4753 if (quest[QUEST_OBERON].status != QUEST_STATUS_FINISHED) max_depth = 98;
4754 else if(quest[QUEST_SERPENT].status != QUEST_STATUS_FINISHED) max_depth = 99;
4758 amt = get_quantity(format("%s¤Î²¿³¬¤Ë¥Æ¥ì¥Ý¡¼¥È¤·¤Þ¤¹¤«¡©", d_name + d_info[select_dungeon].name), max_depth);
4760 amt = get_quantity(format("Teleport to which level of %s? ", d_name + d_info[select_dungeon].name), max_depth);
4765 p_ptr->word_recall = 1;
4766 p_ptr->recall_dungeon = select_dungeon;
4767 max_dlv[p_ptr->recall_dungeon] = ((amt > d_info[select_dungeon].maxdepth) ? d_info[select_dungeon].maxdepth : ((amt < d_info[select_dungeon].mindepth) ? d_info[select_dungeon].mindepth : amt));
4768 if (record_maxdepth)
4770 do_cmd_write_nikki(NIKKI_TRUMP, select_dungeon, "¥È¥é¥ó¥×¥¿¥ï¡¼¤Ç");
4772 do_cmd_write_nikki(NIKKI_TRUMP, select_dungeon, "at Trump Tower");
4775 msg_print("²ó¤ê¤ÎÂ絤¤¬Ä¥¤ê¤Ä¤á¤Æ¤¤¿...");
4777 msg_print("The air about you becomes charged...");
4781 p_ptr->redraw |= (PR_STATUS);
4785 case BACT_LOSE_MUTATION:
4786 if (p_ptr->muta1 || p_ptr->muta2 ||
4787 (p_ptr->muta3 & ~MUT3_GOOD_LUCK) ||
4788 (p_ptr->pseikaku != SEIKAKU_LUCKY &&
4789 (p_ptr->muta3 & MUT3_GOOD_LUCK)))
4791 while(!lose_mutation(0));
4797 msg_print("¼£¤¹¤Ù¤ÆÍÁ³ÊÑ°Û¤¬Ìµ¤¤¡£");
4799 msg_print("You have no mutations.");
4807 case BACT_TSUCHINOKO:
4821 msg_print("Ê¿¹Õ²½¤Îµ·¼°¤ò¹Ô¤Ê¤Ã¤¿¡£");
4823 msg_print("You received an equalization ritual.");
4825 set_virtue(V_COMPASSION, 0);
4826 set_virtue(V_HONOUR, 0);
4827 set_virtue(V_JUSTICE, 0);
4828 set_virtue(V_SACRIFICE, 0);
4829 set_virtue(V_KNOWLEDGE, 0);
4830 set_virtue(V_FAITH, 0);
4831 set_virtue(V_ENLIGHTEN, 0);
4832 set_virtue(V_ENCHANT, 0);
4833 set_virtue(V_CHANCE, 0);
4834 set_virtue(V_NATURE, 0);
4835 set_virtue(V_HARMONY, 0);
4836 set_virtue(V_VITALITY, 0);
4837 set_virtue(V_UNLIFE, 0);
4838 set_virtue(V_PATIENCE, 0);
4839 set_virtue(V_TEMPERANCE, 0);
4840 set_virtue(V_DILIGENCE, 0);
4841 set_virtue(V_VALOUR, 0);
4842 set_virtue(V_INDIVIDUALISM, 0);
4846 case BACT_TELE_TOWN:
4850 paid = eval_ac(p_ptr->dis_ac + p_ptr->dis_to_a);
4864 void do_cmd_quest(void)
4868 if (!cave_have_flag_bold(py, px, FF_QUEST_ENTER))
4871 msg_print("¤³¤³¤Ë¤Ï¥¯¥¨¥¹¥È¤ÎÆþ¸ý¤Ï¤Ê¤¤¡£");
4873 msg_print("You see no quest level here.");
4881 msg_print("¤³¤³¤Ë¤Ï¥¯¥¨¥¹¥È¤Ø¤ÎÆþ¸ý¤¬¤¢¤ê¤Þ¤¹¡£");
4882 if (!get_check("¥¯¥¨¥¹¥È¤ËÆþ¤ê¤Þ¤¹¤«¡©")) return;
4883 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
4884 msg_print("¡Ø¤È¤Ë¤«¤¯Æþ¤Ã¤Æ¤ß¤è¤¦¤¼¤§¡£¡Ù");
4886 msg_print("There is an entry of a quest.");
4887 if (!get_check("Do you enter? ")) return;
4890 /* Player enters a new quest */
4894 leave_quest_check();
4896 if (quest[p_ptr->inside_quest].type != QUEST_TYPE_RANDOM) dun_level = 1;
4897 p_ptr->inside_quest = cave[py][px].special;
4899 p_ptr->leaving = TRUE;
4905 * Do building commands
4907 void do_cmd_bldg(void)
4912 building_type *bldg;
4917 if (!cave_have_flag_bold(py, px, FF_BLDG))
4920 msg_print("¤³¤³¤Ë¤Ï·úʪ¤Ï¤Ê¤¤¡£");
4922 msg_print("You see no building here.");
4928 which = f_info[cave[py][px].feat].subtype;
4930 bldg = &building[which];
4932 /* Don't re-init the wilderness */
4933 reinit_wilderness = FALSE;
4935 if ((which == 2) && (p_ptr->arena_number < 0))
4938 msg_print("¡ÖÇÔ¼Ô¤ËÍѤϤʤ¤¡£¡×");
4940 msg_print("'There's no place here for a LOSER like you!'");
4944 else if ((which == 2) && p_ptr->inside_arena)
4946 if (!p_ptr->exit_bldg)
4949 prt("¥²¡¼¥È¤ÏÊĤޤäƤ¤¤ë¡£¥â¥ó¥¹¥¿¡¼¤¬¤¢¤Ê¤¿¤òÂԤäƤ¤¤ë¡ª", 0, 0);
4951 prt("The gates are closed. The monster awaits!", 0, 0);
4956 /* Don't save the arena as saved floor */
4957 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_NO_RETURN);
4959 p_ptr->inside_arena = FALSE;
4960 p_ptr->leaving = TRUE;
4962 /* Re-enter the arena */
4963 command_new = SPECIAL_KEY_BUILDING;
4965 /* No energy needed to re-enter the arena */
4971 else if (p_ptr->inside_battle)
4973 /* Don't save the arena as saved floor */
4974 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_NO_RETURN);
4976 p_ptr->leaving = TRUE;
4977 p_ptr->inside_battle = FALSE;
4979 /* Re-enter the monster arena */
4980 command_new = SPECIAL_KEY_BUILDING;
4982 /* No energy needed to re-enter the arena */
4993 /* Forget the lite */
4996 /* Forget the view */
4999 /* Hack -- Increase "icky" depth */
5006 show_building(bldg);
5014 building_prt_gold();
5018 if (command == ESCAPE)
5021 p_ptr->inside_arena = FALSE;
5022 p_ptr->inside_battle = FALSE;
5026 for (i = 0; i < 8; i++)
5028 if (bldg->letters[i])
5030 if (bldg->letters[i] == command)
5039 bldg_process_command(bldg, i);
5048 /* Flush messages XXX XXX XXX */
5052 /* Reinit wilderness to activate quests ... */
5053 if (reinit_wilderness)
5055 p_ptr->leaving = TRUE;
5058 /* Hack -- Decrease "icky" depth */
5061 /* Clear the screen */
5064 /* Update the visuals */
5065 p_ptr->update |= (PU_VIEW | PU_MONSTERS | PU_BONUS | PU_LITE | PU_MON_LITE);
5067 /* Redraw entire screen */
5068 p_ptr->redraw |= (PR_BASIC | PR_EXTRA | PR_EQUIPPY | PR_MAP);
5071 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
5075 /* Array of places to find an inscription */
5076 static cptr find_quest[] =
5079 "¾²¤Ë¥á¥Ã¥»¡¼¥¸¤¬¹ï¤Þ¤ì¤Æ¤¤¤ë:",
5081 "You find the following inscription in the floor",
5085 "Êɤ˥á¥Ã¥»¡¼¥¸¤¬¹ï¤Þ¤ì¤Æ¤¤¤ë:",
5087 "You see a message inscribed in the wall",
5091 "¥á¥Ã¥»¡¼¥¸¤ò¸«¤Ä¤±¤¿:",
5093 "There is a sign saying",
5097 "²¿¤«¤¬³¬Ãʤξå¤Ë½ñ¤¤¤Æ¤¢¤ë:",
5099 "Something is written on the staircase",
5103 "´¬Êª¤ò¸«¤Ä¤±¤¿¡£¥á¥Ã¥»¡¼¥¸¤¬½ñ¤¤¤Æ¤¢¤ë:",
5105 "You find a scroll with the following message",
5114 void quest_discovery(int q_idx)
5116 quest_type *q_ptr = &quest[q_idx];
5117 monster_race *r_ptr = &r_info[q_ptr->r_idx];
5118 int q_num = q_ptr->max_num;
5121 /* No quest index */
5124 strcpy(name, (r_name + r_ptr->name));
5126 msg_print(find_quest[rand_range(0, 4)]);
5133 /* Hack -- "unique" monsters must be "unique" */
5134 if ((r_ptr->flags1 & RF1_UNIQUE) &&
5135 (0 == r_ptr->max_num))
5138 msg_print("¤³¤Î³¬¤Ï°ÊÁ°¤Ï狼¤Ë¤è¤Ã¤Æ¼é¤é¤ì¤Æ¤¤¤¿¤è¤¦¤À¡Ä¡£");
5140 msg_print("It seems that this level was protected by someone before...");
5142 /* The unique is already dead */
5143 quest[q_idx].status = QUEST_STATUS_FINISHED;
5148 msg_format("Ãí°Õ¤»¤è¡ª¤³¤Î³¬¤Ï%s¤Ë¤è¤Ã¤Æ¼é¤é¤ì¤Æ¤¤¤ë¡ª", name);
5150 msg_format("Beware, this level is protected by %s!", name);
5156 /* Normal monsters */
5158 msg_format("Ãí°Õ¤·¤í¡ª¤³¤Î³¬¤Ï%dÂΤÎ%s¤Ë¤è¤Ã¤Æ¼é¤é¤ì¤Æ¤¤¤ë¡ª", q_num, name);
5161 msg_format("Be warned, this level is guarded by %d %s!", q_num, name);
5169 * Hack -- Check if a level is a "quest" level
5171 int quest_number(int level)
5176 if (p_ptr->inside_quest)
5177 return (p_ptr->inside_quest);
5179 for (i = 0; i < max_quests; i++)
5181 if (quest[i].status != QUEST_STATUS_TAKEN) continue;
5183 if ((quest[i].type == QUEST_TYPE_KILL_LEVEL) &&
5184 !(quest[i].flags & QUEST_FLAG_PRESET) &&
5185 (quest[i].level == level) &&
5186 (quest[i].dungeon == dungeon_type))
5190 /* Check for random quest */
5191 return (random_quest_number(level));
5196 * Return the index of the random quest on this level
5199 int random_quest_number(int level)
5203 if (dungeon_type != DUNGEON_ANGBAND) return 0;
5205 for (i = MIN_RANDOM_QUEST; i < MAX_RANDOM_QUEST + 1; i++)
5207 if ((quest[i].type == QUEST_TYPE_RANDOM) &&
5208 (quest[i].status == QUEST_STATUS_TAKEN) &&
5209 (quest[i].level == level) &&
5210 (quest[i].dungeon == DUNGEON_ANGBAND))