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)", bldg->member_costs[i]);
134 sprintf(buff, "(%ldgp)", bldg->member_costs[i]);
140 action_color = TERM_YELLOW;
142 sprintf(buff, "($%ld)", bldg->other_costs[i]);
144 sprintf(buff, "(%ldgp)", 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)", bldg->member_costs[i]);
173 sprintf(buff, "(%ldgp)", bldg->member_costs[i]);
179 action_color = TERM_YELLOW;
181 sprintf(buff, "($%ld)", bldg->other_costs[i]);
183 sprintf(buff, "(%ldgp)", 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)", bldg->member_costs[i]);
206 sprintf(buff, "(%ldgp)", 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? "))
285 p_ptr->leftbldg = TRUE;
286 p_ptr->exit_bldg = FALSE;
289 /* Save the surface floor to preserve pets */
290 prepare_change_floor_mode(CFM_SAVE_SURFACE);
292 p_ptr->inside_arena = TRUE;
293 p_ptr->leaving = TRUE;
299 msg_print("»ÄÇ°¤À¡£");
301 msg_print("We are disappointed.");
308 msg_print("¤¢¤Ê¤¿¤Ï¥¢¥ê¡¼¥Ê¤ËÆþ¤ê¡¢¤·¤Ð¤é¤¯¤Î´Ö±É¸÷¤Ë¤Ò¤¿¤Ã¤¿¡£");
310 msg_print("You enter the arena briefly and bask in your glory.");
316 else if (p_ptr->riding && (p_ptr->pclass != CLASS_BEASTMASTER) && (p_ptr->pclass != CLASS_CAVALRY))
319 msg_print("¥Ú¥Ã¥È¤Ë¾è¤Ã¤¿¤Þ¤Þ¤Ç¤Ï¥¢¥ê¡¼¥Ê¤ØÆþ¤ì¤µ¤»¤Æ¤â¤é¤¨¤Ê¤«¤Ã¤¿¡£");
321 msg_print("You don't have permission to enter with pet.");
328 p_ptr->leftbldg = TRUE;
329 p_ptr->exit_bldg = FALSE;
332 /* Save the surface floor to preserve pets */
333 prepare_change_floor_mode(CFM_SAVE_SURFACE);
335 p_ptr->inside_arena = TRUE;
336 p_ptr->leaving = TRUE;
341 if (p_ptr->arena_number == MAX_ARENA_MONS)
343 msg_print("¤¢¤Ê¤¿¤Ï¾¡Íø¼Ô¤À¡£ ¥¢¥ê¡¼¥Ê¤Ç¤Î¥»¥ì¥â¥Ë¡¼¤Ë»²²Ã¤·¤Ê¤µ¤¤¡£");
345 msg_print("You are victorious. Enter the arena for the ceremony.");
348 else if (p_ptr->arena_number > MAX_ARENA_MONS)
351 msg_print("¤¢¤Ê¤¿¤Ï¤¹¤Ù¤Æ¤ÎŨ¤Ë¾¡Íø¤·¤¿¡£");
353 msg_print("You have won against all foes.");
358 r_ptr = &r_info[arena_info[p_ptr->arena_number].r_idx];
359 name = (r_name + r_ptr->name);
361 msg_format("%s ¤ËÄ©À魯¤ë¤â¤Î¤Ï¤¤¤Ê¤¤¤«¡©", name);
363 msg_format("Do I hear any challenges against: %s", name);
367 case BACT_ARENA_RULES:
372 /* Peruse the arena help file */
374 (void)show_file(TRUE, "arena_j.txt", NULL, 0, 0);
376 (void)show_file(TRUE, "arena.txt", NULL, 0, 0);
389 * display fruit for dice slots
391 static void display_fruit(int row, int col, int fruit)
397 c_put_str(TERM_YELLOW, " ####.", row, col);
398 c_put_str(TERM_YELLOW, " # #", row + 1, col);
399 c_put_str(TERM_YELLOW, " # #", row + 2, col);
400 c_put_str(TERM_YELLOW, "# #", row + 3, col);
401 c_put_str(TERM_YELLOW, "# #", row + 4, col);
402 c_put_str(TERM_YELLOW, "# # ", row + 5, col);
403 c_put_str(TERM_YELLOW, "# # ", row + 6, col);
404 c_put_str(TERM_YELLOW, ".#### ", row + 7, col);
405 prt( " ¥ì¥â¥ó ", row + 8, col);
407 c_put_str(TERM_YELLOW, " ####.", row, col);
408 c_put_str(TERM_YELLOW, " # #", row + 1, col);
409 c_put_str(TERM_YELLOW, " # #", row + 2, col);
410 c_put_str(TERM_YELLOW, "# #", row + 3, col);
411 c_put_str(TERM_YELLOW, "# #", row + 4, col);
412 c_put_str(TERM_YELLOW, "# # ", row + 5, col);
413 c_put_str(TERM_YELLOW, "# # ", row + 6, col);
414 c_put_str(TERM_YELLOW, ".#### ", row + 7, col);
415 prt( " Lemon ", row + 8, col);
421 c_put_str(TERM_ORANGE, " ## ", row, col);
422 c_put_str(TERM_ORANGE, " #..# ", row + 1, col);
423 c_put_str(TERM_ORANGE, " #....# ", row + 2, col);
424 c_put_str(TERM_ORANGE, "#......#", row + 3, col);
425 c_put_str(TERM_ORANGE, "#......#", row + 4, col);
426 c_put_str(TERM_ORANGE, " #....# ", row + 5, col);
427 c_put_str(TERM_ORANGE, " #..# ", row + 6, col);
428 c_put_str(TERM_ORANGE, " ## ", row + 7, col);
429 prt( "¥ª¥ì¥ó¥¸", row + 8, col);
431 c_put_str(TERM_ORANGE, " ## ", row, col);
432 c_put_str(TERM_ORANGE, " #..# ", row + 1, col);
433 c_put_str(TERM_ORANGE, " #....# ", row + 2, col);
434 c_put_str(TERM_ORANGE, "#......#", row + 3, col);
435 c_put_str(TERM_ORANGE, "#......#", row + 4, col);
436 c_put_str(TERM_ORANGE, " #....# ", row + 5, col);
437 c_put_str(TERM_ORANGE, " #..# ", row + 6, col);
438 c_put_str(TERM_ORANGE, " ## ", row + 7, col);
439 prt( " Orange ", row + 8, col);
445 c_put_str(TERM_SLATE, " ¦« " , row, col);
446 c_put_str(TERM_SLATE, " || " , row + 1, col);
447 c_put_str(TERM_SLATE, " || " , row + 2, col);
448 c_put_str(TERM_SLATE, " || " , row + 3, col);
449 c_put_str(TERM_SLATE, " || " , row + 4, col);
450 c_put_str(TERM_SLATE, " || " , row + 5, col);
451 c_put_str(TERM_UMBER, " |=°¡=| " , row + 6, col);
452 c_put_str(TERM_UMBER, " ÌÜ " , row + 7, col);
453 prt( " ·õ " , row + 8, col);
455 c_put_str(TERM_SLATE, " /\\ " , row, col);
456 c_put_str(TERM_SLATE, " ## " , row + 1, col);
457 c_put_str(TERM_SLATE, " ## " , row + 2, col);
458 c_put_str(TERM_SLATE, " ## " , row + 3, col);
459 c_put_str(TERM_SLATE, " ## " , row + 4, col);
460 c_put_str(TERM_SLATE, " ## " , row + 5, col);
461 c_put_str(TERM_UMBER, " ###### " , row + 6, col);
462 c_put_str(TERM_UMBER, " ## " , row + 7, col);
463 prt( " Sword " , row + 8, col);
469 c_put_str(TERM_SLATE, " ###### ", row, col);
470 c_put_str(TERM_SLATE, "# #", row + 1, col);
471 c_put_str(TERM_SLATE, "# ++++ #", row + 2, col);
472 c_put_str(TERM_SLATE, "# +==+ #", row + 3, col);
473 c_put_str(TERM_SLATE, "# ++ #", row + 4, col);
474 c_put_str(TERM_SLATE, " # # ", row + 5, col);
475 c_put_str(TERM_SLATE, " # # ", row + 6, col);
476 c_put_str(TERM_SLATE, " ## ", row + 7, col);
477 prt( " ½â ", row + 8, col);
479 c_put_str(TERM_SLATE, " ###### ", row, col);
480 c_put_str(TERM_SLATE, "# #", row + 1, col);
481 c_put_str(TERM_SLATE, "# ++++ #", row + 2, col);
482 c_put_str(TERM_SLATE, "# +==+ #", row + 3, col);
483 c_put_str(TERM_SLATE, "# ++ #", row + 4, col);
484 c_put_str(TERM_SLATE, " # # ", row + 5, col);
485 c_put_str(TERM_SLATE, " # # ", row + 6, col);
486 c_put_str(TERM_SLATE, " ## ", row + 7, col);
487 prt( " Shield ", row + 8, col);
493 c_put_str(TERM_VIOLET, " ## ", row, col);
494 c_put_str(TERM_VIOLET, " ###### ", row + 1, col);
495 c_put_str(TERM_VIOLET, "########", row + 2, col);
496 c_put_str(TERM_VIOLET, "########", row + 3, col);
497 c_put_str(TERM_VIOLET, "########", row + 4, col);
498 c_put_str(TERM_VIOLET, " ###### ", row + 5, col);
499 c_put_str(TERM_VIOLET, " #### ", row + 6, col);
500 c_put_str(TERM_VIOLET, " ## ", row + 7, col);
501 prt( " ¥×¥é¥à ", row + 8, col);
503 c_put_str(TERM_VIOLET, " ## ", row, col);
504 c_put_str(TERM_VIOLET, " ###### ", row + 1, col);
505 c_put_str(TERM_VIOLET, "########", row + 2, col);
506 c_put_str(TERM_VIOLET, "########", row + 3, col);
507 c_put_str(TERM_VIOLET, "########", row + 4, col);
508 c_put_str(TERM_VIOLET, " ###### ", row + 5, col);
509 c_put_str(TERM_VIOLET, " #### ", row + 6, col);
510 c_put_str(TERM_VIOLET, " ## ", row + 7, col);
511 prt( " Plum ", row + 8, col);
517 c_put_str(TERM_RED, " ##", row, col);
518 c_put_str(TERM_RED, " ### ", row + 1, col);
519 c_put_str(TERM_RED, " #..# ", row + 2, col);
520 c_put_str(TERM_RED, " #..# ", row + 3, col);
521 c_put_str(TERM_RED, " ###### ", row + 4, col);
522 c_put_str(TERM_RED, "#..##..#", row + 5, col);
523 c_put_str(TERM_RED, "#..##..#", row + 6, col);
524 c_put_str(TERM_RED, " ## ## ", row + 7, col);
525 prt( "¥Á¥§¥ê¡¼", row + 8, col);
527 c_put_str(TERM_RED, " ##", row, col);
528 c_put_str(TERM_RED, " ### ", row + 1, col);
529 c_put_str(TERM_RED, " #..# ", row + 2, col);
530 c_put_str(TERM_RED, " #..# ", row + 3, col);
531 c_put_str(TERM_RED, " ###### ", row + 4, col);
532 c_put_str(TERM_RED, "#..##..#", row + 5, col);
533 c_put_str(TERM_RED, "#..##..#", row + 6, col);
534 c_put_str(TERM_RED, " ## ## ", row + 7, col);
535 prt( " Cherry ", row + 8, col);
543 * kpoker no (tyuto-hannpa na)pakuri desu...
544 * joker ha shineru node haitte masen.
546 * TODO: donataka! tsukutte!
547 * - agatta yaku no kiroku (like DQ).
548 * - kakkoii card no e.
549 * - sousa-sei no koujyo.
550 * - code wo wakariyasuku.
552 * - Joker... -- done.
555 * 9/15/2000 joker wo jissou. soreto, code wo sukosi kakikae. --Habu
557 #define SUIT_OF(card) ((card) / 13)
558 #define NUM_OF(card) ((card) % 13)
559 #define IS_JOKER(card) ((card) == 52)
561 static int cards[5]; /* tefuda no card */
563 static void reset_deck(int deck[])
566 for (i = 0; i < 53; i++) deck[i] = i;
569 for (i = 0; i < 53; i++){
570 int tmp1 = randint0(53 - i) + i;
572 deck[i] = deck[tmp1];
577 static bool have_joker(void)
581 for (i = 0; i < 5; i++){
582 if(IS_JOKER(cards[i])) return TRUE;
587 static bool find_card_num(int num)
590 for (i = 0; i < 5; i++)
591 if (NUM_OF(cards[i]) == num && !IS_JOKER(cards[i])) return TRUE;
595 static bool yaku_check_flush(void)
598 bool joker_is_used = FALSE;
600 suit = IS_JOKER(cards[0]) ? SUIT_OF(cards[1]) : SUIT_OF(cards[0]);
601 for (i = 0; i < 5; i++){
602 if (SUIT_OF(cards[i]) != suit){
603 if(have_joker() && !joker_is_used)
604 joker_is_used = TRUE;
613 static int yaku_check_straight(void)
616 bool joker_is_used = FALSE;
619 for (i = 0; i < 5; i++)
621 if (NUM_OF(cards[i]) < lowest && !IS_JOKER(cards[i]))
622 lowest = NUM_OF(cards[i]);
625 if (yaku_check_flush())
628 for (i = 0; i < 4; i++)
630 if (!find_card_num(9 + i)){
631 if( have_joker() && !joker_is_used )
632 joker_is_used = TRUE;
637 if (i == 4) return 3; /* Wow! Royal Flush!!! */
640 for (i = 0; i < 3; i++)
642 if (!find_card_num(10 + i))
645 if (i == 3 && have_joker()) return 3; /* Wow! Royal Flush!!! */
649 joker_is_used = FALSE;
650 for (i = 0; i < 5; i++)
652 if (!find_card_num(lowest + i)){
653 if( have_joker() && !joker_is_used )
654 joker_is_used = TRUE;
660 if (yaku_check_flush())
661 return 2; /* Straight Flush */
667 * 0:nopair 1:1 pair 2:2 pair 3:3 cards 4:full house 6:4cards
669 static int yaku_check_pair(void)
671 int i, i2, matching = 0;
673 for (i = 0; i < 5; i++)
675 for (i2 = i+1; i2 < 5; i2++)
677 if (IS_JOKER(cards[i]) || IS_JOKER(cards[i2])) continue;
678 if (NUM_OF(cards[i]) == NUM_OF(cards[i2]))
720 static int yaku_check(void)
724 switch(yaku_check_straight()){
727 c_put_str(TERM_YELLOW, "¥í¥¤¥ä¥ë¥¹¥È¥ì¡¼¥È¥Õ¥é¥Ã¥·¥å", 4, 3);
729 c_put_str(TERM_YELLOW, "Royal Flush", 4, 3);
734 c_put_str(TERM_YELLOW, "¥¹¥È¥ì¡¼¥È¥Õ¥é¥Ã¥·¥å", 4, 3);
736 c_put_str(TERM_YELLOW, "Straight Flush", 4, 3);
741 c_put_str(TERM_YELLOW, "¥¹¥È¥ì¡¼¥È", 4, 3);
743 c_put_str(TERM_YELLOW, "Straight", 4, 3);
747 /* Not straight -- fall through */
751 if (yaku_check_flush())
755 c_put_str(TERM_YELLOW, "¥Õ¥é¥Ã¥·¥å", 4, 3);
757 c_put_str(TERM_YELLOW, "Flush", 4, 3);
762 switch (yaku_check_pair())
766 c_put_str(TERM_YELLOW, "¥ï¥ó¥Ú¥¢", 4, 3);
768 c_put_str(TERM_YELLOW, "One pair", 4, 3);
773 c_put_str(TERM_YELLOW, "¥Ä¡¼¥Ú¥¢", 4, 3);
775 c_put_str(TERM_YELLOW, "Two pair", 4, 3);
780 c_put_str(TERM_YELLOW, "¥¹¥ê¡¼¥«¡¼¥É", 4, 3);
782 c_put_str(TERM_YELLOW, "Three of a kind", 4, 3);
787 c_put_str(TERM_YELLOW, "¥Õ¥ë¥Ï¥¦¥¹", 4, 3);
789 c_put_str(TERM_YELLOW, "Full house", 4, 3);
794 c_put_str(TERM_YELLOW, "¥Õ¥©¡¼¥«¡¼¥É", 4, 3);
796 c_put_str(TERM_YELLOW, "Four of a kind", 4, 3);
800 if (!NUM_OF(cards[0]) || !NUM_OF(cards[1]))
803 c_put_str(TERM_YELLOW, "¥Õ¥¡¥¤¥Ö¥¨¡¼¥¹", 4, 3);
805 c_put_str(TERM_YELLOW, "Five ace", 4, 3);
812 c_put_str(TERM_YELLOW, "¥Õ¥¡¥¤¥Ö¥«¡¼¥É", 4, 3);
814 c_put_str(TERM_YELLOW, "Five of a kind", 4, 3);
824 static void display_kaeruka(int hoge, int kaeruka[])
827 char col = TERM_WHITE;
828 for (i = 0; i < 5; i++)
830 if (i == hoge) col = TERM_YELLOW;
831 else if(kaeruka[i]) col = TERM_WHITE;
832 else col = TERM_L_BLUE;
835 c_put_str(col, "¤«¤¨¤ë", 14, 5+i*16);
837 c_put_str(col, "¤Î¤³¤¹", 14, 5+i*16);
840 c_put_str(col, "Change", 14, 5+i*16);
842 c_put_str(col, " Stay ", 14, 5+i*16);
845 if (hoge > 4) col = TERM_YELLOW;
846 else col = TERM_WHITE;
848 c_put_str(col, "·èÄê", 16, 38);
850 c_put_str(col, "Sure", 16, 38);
853 /* Hilite current option */
854 if (hoge < 5) move_cursor(14, 5+hoge*16);
855 else move_cursor(16, 38);
859 static void display_cards(void)
862 char suitcolor[4] = {TERM_YELLOW, TERM_L_RED, TERM_L_BLUE, TERM_L_GREEN};
864 cptr suit[4] = {"¡ú", "¡ü", "¢ù", "¢÷"};
865 cptr card_grph[13][7] = {{"£Á %s ",
956 cptr joker_grph[7] = { " ",
966 cptr suit[4] = {"[]", "qp", "<>", "db"};
967 cptr card_grph[13][7] = {{"A %s ",
1058 cptr joker_grph[7] = { " ",
1067 for (i = 0; i < 5; i++)
1070 prt("¨®¨¬¨¬¨¬¨¬¨¬¨¬¨¯", 5, i*16);
1072 prt(" +------------+ ", 5, i*16);
1076 for (i = 0; i < 5; i++)
1078 for (j = 0; j < 7; j++)
1081 prt("¨", j+6, i*16);
1083 prt(" |", j+6, i*16);
1085 if(IS_JOKER(cards[i]))
1086 c_put_str(TERM_VIOLET, joker_grph[j], j+6, 2+i*16);
1088 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);
1090 prt("¨", j+6, i*16+14);
1092 prt("| ", j+6, i*16+14);
1096 for (i = 0; i < 5; i++)
1099 prt("¨±¨¬¨¬¨¬¨¬¨¬¨¬¨°", 13, i*16);
1101 prt(" +------------+ ", 13, i*16);
1106 static int do_poker(void)
1110 int deck[53]; /* yamafuda : 0...52 */
1112 int kaeruka[5]; /* 0:kaenai 1:kaeru */
1116 bool kakikae = TRUE;
1120 for (i = 0; i < 5; i++)
1122 cards[i] = deck[deck_ptr++];
1123 kaeruka[i] = 0; /* default:nokosu */
1143 /* debug:Four Cards */
1145 cards[1] = 0 + 13 * 1;
1146 cards[2] = 0 + 13 * 2;
1147 cards[3] = 0 + 13 * 3;
1151 /* debug:Straight */
1167 /* suteruno wo kimeru */
1169 prt("»Ä¤¹¥«¡¼¥É¤ò·è¤á¤Æ²¼¤µ¤¤(Êý¸þ¤Ç°ÜÆ°, ¥¹¥Ú¡¼¥¹¤ÇÁªÂò)¡£", 0, 0);
1171 prt("Stay witch? ", 0, 0);
1179 if (kakikae) display_kaeruka(k+kettei*5, kaeruka);
1184 case '6': case 'l': case 'L': case KTRL('F'):
1185 if (!kettei) k = (k+1)%5;
1186 else {k = 0;kettei = FALSE;}
1189 case '4': case 'h': case 'H': case KTRL('B'):
1190 if (!kettei) k = (k+4)%5;
1191 else {k = 4;kettei = FALSE;}
1194 case '2': case 'j': case 'J': case KTRL('N'):
1195 if (!kettei) {kettei = TRUE;kakikae = TRUE;}
1197 case '8': case 'k': case 'K': case KTRL('P'):
1198 if (kettei) {kettei = FALSE;kakikae = TRUE;}
1200 case ' ': case '\r':
1201 if (kettei) done = TRUE;
1202 else {kaeruka[k] = !kaeruka[k];kakikae = TRUE;}
1211 for (i = 0; i < 5; i++)
1212 if (kaeruka[i] == 1) cards[i] = deck[deck_ptr++]; /* soshite toru */
1216 return yaku_check();
1221 /* end of poker codes --Koka */
1226 static bool gamble_comm(int cmd)
1229 int roll1, roll2, roll3, choice, odds, win;
1234 char out_val[160], tmp_str[80], again;
1239 if (cmd == BACT_GAMBLE_RULES)
1241 /* Peruse the gambling help file */
1243 (void)show_file(TRUE, "jgambling.txt", NULL, 0, 0);
1245 (void)show_file(TRUE, "gambling.txt", NULL, 0, 0);
1255 msg_print("¤ª¤¤¡ª¤ª¤Þ¤¨°ìʸ¤Ê¤·¤¸¤ã¤Ê¤¤¤«¡ª¤³¤Ã¤«¤é½Ð¤Æ¤¤¤±¡ª");
1257 msg_print("Hey! You don't have gold - get out of here!");
1267 maxbet = p_ptr->lev * 200;
1269 /* We can't bet more than we have */
1270 maxbet = MIN(maxbet, p_ptr->au);
1273 strcpy(out_val, "");
1275 sprintf(tmp_str,"ÅÒ¤±¶â (1-%ld)¡©", maxbet);
1277 sprintf(tmp_str,"Your wager (1-%ld) ? ", maxbet);
1282 * Use get_string() because we may need more than
1283 * the s16b value returned by get_quantity().
1285 if (get_string(tmp_str, out_val, 32))
1288 for (p = out_val; *p == ' '; p++);
1293 if (wager > p_ptr->au)
1296 msg_print("¤ª¤¤¡ª¶â¤¬Â¤ê¤Ê¤¤¤¸¤ã¤Ê¤¤¤«¡ª½Ð¤Æ¤¤¤±¡ª");
1298 msg_print("Hey! You don't have the gold - get out of here!");
1305 else if (wager > maxbet)
1308 msg_format("%ld¥´¡¼¥ë¥É¤À¤±¼õ¤±¤è¤¦¡£»Ä¤ê¤Ï¼è¤Ã¤È¤¤Ê¡£", maxbet);
1310 msg_format("I'll take %ld gold of that. Keep the rest.", maxbet);
1318 msg_print("£Ï£Ë¡¢£±¥´¡¼¥ë¥É¤«¤é¤Ï¤¸¤á¤è¤¦¡£");
1320 msg_print("Ok, we'll start with 1 gold.");
1329 oldgold = p_ptr->au;
1332 sprintf(tmp_str, "¥²¡¼¥àÁ°¤Î½ê»ý¶â: %9ld", oldgold);
1334 sprintf(tmp_str, "Gold before game: %9ld", oldgold);
1337 prt(tmp_str, 20, 2);
1340 sprintf(tmp_str, "¸½ºß¤Î³Ý¤±¶â: %9ld", wager);
1342 sprintf(tmp_str, "Current Wager: %9ld", wager);
1345 prt(tmp_str, 21, 2);
1347 /* Prevent savefile-scumming of the casino */
1348 /* Rand_quick = TRUE; */
1349 Rand_value = time(NULL);
1353 #ifdef JP /* Prevent random seed cracking of the casino */
1361 case BACT_IN_BETWEEN: /* Game of In-Between */
1363 c_put_str(TERM_GREEN, "¥¤¥ó¡¦¥Ó¥È¥¤¡¼¥ó",5,2);
1365 c_put_str(TERM_GREEN, "In Between", 5, 2);
1370 roll1 = randint1(10);
1371 roll2 = randint1(10);
1372 choice = randint1(10);
1374 sprintf(tmp_str, "¹õ¥À¥¤¥¹: %d ¹õ¥À¥¤¥¹: %d", roll1, roll2);
1376 sprintf(tmp_str, "Black die: %d Black Die: %d", roll1, roll2);
1381 sprintf(tmp_str, "ÀÖ¥À¥¤¥¹: %d", choice);
1383 sprintf(tmp_str, "Red die: %d", choice);
1386 prt(tmp_str, 11, 14);
1387 if (((choice > roll1) && (choice < roll2)) ||
1388 ((choice < roll1) && (choice > roll2)))
1391 case BACT_CRAPS: /* Game of Craps */
1393 c_put_str(TERM_GREEN, "¥¯¥é¥Ã¥×¥¹", 5, 2);
1395 c_put_str(TERM_GREEN, "Craps", 5, 2);
1400 roll1 = randint1(6);
1401 roll2 = randint1(6);
1402 roll3 = roll1 + roll2;
1405 sprintf(tmp_str, "£±¿¶¤ê¤á: %d %d Total: %d", roll1,
1407 sprintf(tmp_str, "First roll: %d %d Total: %d", roll1,
1412 if ((roll3 == 7) || (roll3 == 11))
1414 else if ((roll3 == 2) || (roll3 == 3) || (roll3 == 12))
1420 msg_print("¤Ê¤Ë¤«¥¡¼¤ò²¡¤¹¤È¤â¤¦°ì²ó¿¶¤ê¤Þ¤¹¡£");
1422 msg_print("Hit any key to roll again");
1426 roll1 = randint1(6);
1427 roll2 = randint1(6);
1428 roll3 = roll1 + roll2;
1431 sprintf(tmp_str, "½ÐÌÜ: %d %d ¹ç·×: %d",
1433 sprintf(tmp_str, "Roll result: %d %d Total: %d",
1436 roll1, roll2, roll3);
1438 if (roll3 == choice)
1440 else if (roll3 == 7)
1442 } while ((win != TRUE) && (win != FALSE));
1445 case BACT_SPIN_WHEEL: /* Spin the Wheel Game */
1449 c_put_str(TERM_GREEN, "¥ë¡¼¥ì¥Ã¥È", 5, 2);
1451 c_put_str(TERM_GREEN, "Wheel", 5, 2);
1454 prt("0 1 2 3 4 5 6 7 8 9", 7, 5);
1455 prt("--------------------------------", 8, 3);
1456 strcpy(out_val, "");
1458 get_string("²¿ÈÖ¡© (0-9): ", out_val, 32);
1460 get_string("Pick a number (0-9): ", out_val, 32);
1463 for (p = out_val; isspace(*p); p++);
1468 msg_print("0È֤ˤ·¤È¤¯¤¼¡£");
1470 msg_print("I'll put you down for 0.");
1475 else if (choice > 9)
1478 msg_print("£Ï£Ë¡¢9È֤ˤ·¤È¤¯¤¼¡£");
1480 msg_print("Ok, I'll put you down for 9.");
1486 roll1 = randint0(10);
1488 sprintf(tmp_str, "¥ë¡¼¥ì¥Ã¥È¤Ï²ó¤ê¡¢»ß¤Þ¤Ã¤¿¡£¾¡¼Ô¤Ï %dÈÖ¤À¡£",
1490 sprintf(tmp_str, "The wheel spins to a stop and the winner is %d",
1494 prt(tmp_str, 13, 3);
1496 prt("*", 9, (3 * roll1 + 5));
1497 if (roll1 == choice)
1501 case BACT_DICE_SLOTS: /* The Dice Slots */
1503 c_put_str(TERM_GREEN, "¥À¥¤¥¹¡¦¥¹¥í¥Ã¥È", 5, 2);
1504 c_put_str(TERM_YELLOW, "¥ì¥â¥ó ¥ì¥â¥ó 2", 6, 37);
1505 c_put_str(TERM_YELLOW, "¥ì¥â¥ó ¥ì¥â¥ó ¥ì¥â¥ó 5", 7, 37);
1506 c_put_str(TERM_ORANGE, "¥ª¥ì¥ó¥¸ ¥ª¥ì¥ó¥¸ ¥ª¥ì¥ó¥¸ 10", 8, 37);
1507 c_put_str(TERM_UMBER, "·õ ·õ ·õ 20", 9, 37);
1508 c_put_str(TERM_SLATE, "½â ½â ½â 50", 10, 37);
1509 c_put_str(TERM_VIOLET, "¥×¥é¥à ¥×¥é¥à ¥×¥é¥à 200", 11, 37);
1510 c_put_str(TERM_RED, "¥Á¥§¥ê¡¼ ¥Á¥§¥ê¡¼ ¥Á¥§¥ê¡¼ 1000", 12, 37);
1512 c_put_str(TERM_GREEN, "Dice Slots", 5, 2);
1516 roll1 = randint1(21);
1526 roll2 = randint1(21);
1536 choice = randint1(21);
1546 put_str("/--------------------------\\", 7, 2);
1547 prt("\\--------------------------/", 17, 2);
1548 display_fruit(8, 3, roll1 - 1);
1549 display_fruit(8, 12, roll2 - 1);
1550 display_fruit(8, 21, choice - 1);
1551 if ((roll1 == roll2) && (roll2 == choice))
1570 else if ((roll1 == 1) && (roll2 == 1))
1579 if (odds) win = TRUE;
1586 prt("¤¢¤Ê¤¿¤Î¾¡¤Á", 16, 37);
1588 prt("YOU WON", 16, 37);
1591 p_ptr->au += odds * wager;
1593 sprintf(tmp_str, "ÇÜΨ: %d", odds);
1595 sprintf(tmp_str, "Payoff: %d", odds);
1598 prt(tmp_str, 17, 37);
1603 prt("¤¢¤Ê¤¿¤ÎÉ餱", 16, 37);
1605 prt("You Lost", 16, 37);
1611 sprintf(tmp_str, "¸½ºß¤Î½ê»ý¶â: %9ld", p_ptr->au);
1613 sprintf(tmp_str, "Current Gold: %9ld", p_ptr->au);
1616 prt(tmp_str, 22, 2);
1618 prt("¤â¤¦°ìÅÙ(Y/N)¡©", 18, 37);
1620 prt("Again(Y/N)?", 18, 37);
1623 move_cursor(18, 52);
1628 if (wager > p_ptr->au)
1631 msg_print("¤ª¤¤¡ª¶â¤¬Â¤ê¤Ê¤¤¤¸¤ã¤Ê¤¤¤«¡ª¤³¤³¤«¤é½Ð¤Æ¹Ô¤±¡ª");
1633 msg_print("Hey! You don't have the gold - get out of here!");
1641 } while ((again == 'y') || (again == 'Y'));
1643 /* Switch back to complex RNG */
1647 if (p_ptr->au >= oldgold)
1650 msg_print("¡Öº£²ó¤ÏÌÙ¤±¤¿¤Ê¡ª¤Ç¤â¼¡¤Ï¤³¤Ã¤Á¤¬¾¡¤Ã¤Æ¤ä¤ë¤«¤é¤Ê¡¢ÀäÂФˡª¡×");
1652 msg_print("You came out a winner! We'll win next time, I'm sure.");
1654 chg_virtue(V_CHANCE, 3);
1659 msg_print("¡Ö¶â¤ò¥¹¥Ã¤Æ¤·¤Þ¤Ã¤¿¤Ê¡¢¤ï¤Ï¤Ï¡ª¤¦¤Á¤Ëµ¢¤Ã¤¿Êý¤¬¤¤¤¤¤¼¡£¡×");
1661 msg_print("You lost gold! Haha, better head home.");
1663 chg_virtue(V_CHANCE, -3);
1672 static bool vault_aux_battle(int r_idx)
1677 monster_race *r_ptr = &r_info[r_idx];
1679 /* Decline town monsters */
1680 /* if (!mon_hook_dungeon(r_idx)) return FALSE; */
1682 /* Decline unique monsters */
1683 /* if (r_ptr->flags1 & (RF1_UNIQUE)) return (FALSE); */
1684 /* if (r_ptr->flags7 & (RF7_NAZGUL)) return (FALSE); */
1686 if (r_ptr->flags1 & (RF1_NEVER_MOVE)) return (FALSE);
1687 if (r_ptr->flags2 & (RF2_MULTIPLY)) return (FALSE);
1688 if (r_ptr->flags2 & (RF2_QUANTUM)) return (FALSE);
1689 if (r_ptr->flags7 & (RF7_AQUATIC)) return (FALSE);
1690 if (r_ptr->flags7 & (RF7_CHAMELEON)) return (FALSE);
1692 for (i = 0; i < 4; i++)
1694 if (r_ptr->blow[i].method == RBM_EXPLODE) return (FALSE);
1695 if (r_ptr->blow[i].effect != RBE_DR_MANA) dam += r_ptr->blow[i].d_dice;
1697 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);
1703 void battle_monsters(void)
1710 bool old_inside_battle = p_ptr->inside_battle;
1712 for (i = 0; i < max_d_idx; i++)
1713 if (max_dl < max_dlv[i]) max_dl = max_dlv[i];
1715 mon_level = randint1(MIN(max_dl, 122))+5;
1716 if (randint0(100) < 60)
1718 i = randint1(MIN(max_dl, 122))+5;
1719 mon_level = MAX(i, mon_level);
1721 if (randint0(100) < 30)
1723 i = randint1(MIN(max_dl, 122))+5;
1724 mon_level = MAX(i, mon_level);
1736 get_mon_num_prep(vault_aux_battle, NULL);
1737 p_ptr->inside_battle = TRUE;
1738 r_idx = get_mon_num(mon_level);
1739 p_ptr->inside_battle = old_inside_battle;
1740 if (!r_idx) continue;
1742 if ((r_info[r_idx].flags1 & RF1_UNIQUE) || (r_info[r_idx].flags7 & RF7_UNIQUE2))
1744 if ((r_info[r_idx].level + 10) > mon_level) continue;
1747 for (j = 0; j < i; j++)
1748 if(r_idx == battle_mon[j]) break;
1753 battle_mon[i] = r_idx;
1754 if (r_info[r_idx].level < 45) tekitou = TRUE;
1759 monster_race *r_ptr = &r_info[battle_mon[i]];
1760 int num_taisei = count_bits(r_ptr->flagsr & (RFR_IM_ACID | RFR_IM_ELEC | RFR_IM_FIRE | RFR_IM_COLD | RFR_IM_POIS));
1762 if (r_ptr->flags1 & RF1_FORCE_MAXHP)
1763 power[i] = r_ptr->hdice * r_ptr->hside * 2;
1765 power[i] = r_ptr->hdice * (r_ptr->hside + 1);
1766 power[i] = power[i] * (100 + r_ptr->level) / 100;
1767 if (r_ptr->speed > 110)
1768 power[i] = power[i] * (r_ptr->speed * 2 - 110) / 100;
1769 if (r_ptr->speed < 110)
1770 power[i] = power[i] * (r_ptr->speed - 20) / 100;
1772 power[i] = power[i] * (num_taisei*2+5) / 10;
1773 else if (r_ptr->flags6 & RF6_INVULNER)
1774 power[i] = power[i] * 4 / 3;
1775 else if (r_ptr->flags6 & RF6_HEAL)
1776 power[i] = power[i] * 4 / 3;
1777 else if (r_ptr->flags5 & RF5_DRAIN_MANA)
1778 power[i] = power[i] * 11 / 10;
1779 if (r_ptr->flags1 & RF1_RAND_25)
1780 power[i] = power[i] * 9 / 10;
1781 if (r_ptr->flags1 & RF1_RAND_50)
1782 power[i] = power[i] * 9 / 10;
1784 switch (battle_mon[i])
1795 case MON_UND_BEHOLDER:
1796 case MON_SANTACLAUS:
1797 case MON_ULT_BEHOLDER:
1799 case MON_ATLACH_NACHA:
1801 power[i] = power[i] * 3 / 5;
1803 case MON_ROBIN_HOOD:
1807 case MON_CRYPT_THING:
1808 case MON_MASTER_LICH:
1809 case MON_DREADMASTER:
1811 case MON_SHADOWLORD:
1816 case MON_VENOM_WYRM:
1817 case MON_MASTER_MYS:
1818 case MON_G_MASTER_MYS:
1819 power[i] = power[i] * 3 / 4;
1821 case MON_VORPAL_BUNNY:
1824 case MON_LOG_MASTER:
1826 case MON_GRAV_HOUND:
1829 case MON_CLUB_DEMON:
1831 case MON_NIGHTCRAWLER:
1832 case MON_NIGHTWALKER:
1838 case MON_SPECT_WYRM:
1843 power[i] = power[i] * 4 / 3;
1845 case MON_UMBER_HULK:
1849 case MON_ENERGY_VOR:
1853 case MON_PLASMA_VOR:
1858 case MON_STORMBRINGER:
1859 case MON_TIME_HOUND:
1860 case MON_PLASMA_HOUND:
1863 case MON_AETHER_VOR:
1864 case MON_AETHER_HOUND:
1872 case MON_D_ELF_SHADE:
1873 case MON_MANA_HOUND:
1875 case MON_BANORLUPART:
1880 power[i] = power[i] * 3 / 2;
1884 case MON_CYBER_KING:
1885 case MON_UNICORN_ORD:
1886 power[i] = power[i] * 5 / 3;
1890 case MON_WYRM_POWER:
1910 power[i] = total*60/power[i];
1911 if (tekitou && ((power[i] < 160) || power[i] > 1500)) break;
1912 if ((power[i] < 160) && randint0(20)) break;
1913 if (power[i] < 101) power[i] = 100 + randint1(5);
1914 mon_odds[i] = power[i];
1920 static bool kakutoujou(void)
1924 char out_val[160], tmp_str[80];
1927 if ((turn - old_battle) > TURNS_PER_TICK*250)
1939 msg_print("¤ª¤¤¡ª¤ª¤Þ¤¨°ìʸ¤Ê¤·¤¸¤ã¤Ê¤¤¤«¡ª¤³¤Ã¤«¤é½Ð¤Æ¤¤¤±¡ª");
1941 msg_print("Hey! You don't have gold - get out of here!");
1955 prt("¥â¥ó¥¹¥¿¡¼ ÇÜΨ", 4, 4);
1957 prt("Monsters Odds", 4, 4);
1962 monster_race *r_ptr = &r_info[battle_mon[i]];
1965 sprintf(buf,"%d) %-58s %4ld.%02ldÇÜ", i+1, format("%s%s",r_name + r_ptr->name, (r_ptr->flags1 & RF1_UNIQUE) ? "¤â¤É¤" : " "), mon_odds[i]/100, mon_odds[i]%100);
1967 sprintf(buf,"%d) %-58s %4ld.%02ld", i+1, format("%s%s", (r_ptr->flags1 & RF1_UNIQUE) ? "Fake " : "", r_name + r_ptr->name), mon_odds[i]/100, mon_odds[i]%100);
1973 prt("¤É¤ì¤ËÅÒ¤±¤Þ¤¹¤«:", 0, 0);
1975 prt("Which monster: ", 0, 0);
1986 if (i >= '1' && i <= '4')
1988 sel_monster = i-'1';
1989 battle_odds = mon_odds[sel_monster];
1997 if (i !=sel_monster) clear_bldg(i+5,i+5);
1999 maxbet = p_ptr->lev * 200;
2001 /* We can't bet more than we have */
2002 maxbet = MIN(maxbet, p_ptr->au);
2005 strcpy(out_val, "");
2007 sprintf(tmp_str,"ÅÒ¤±¶â (1-%ld)¡©", maxbet);
2009 sprintf(tmp_str,"Your wager (1-%ld) ? ", maxbet);
2014 * Use get_string() because we may need more than
2015 * the s16b value returned by get_quantity().
2017 if (get_string(tmp_str, out_val, 32))
2020 for (p = out_val; *p == ' '; p++);
2025 if (wager > p_ptr->au)
2028 msg_print("¤ª¤¤¡ª¶â¤¬Â¤ê¤Ê¤¤¤¸¤ã¤Ê¤¤¤«¡ª½Ð¤Æ¤¤¤±¡ª");
2030 msg_print("Hey! You don't have the gold - get out of here!");
2037 else if (wager > maxbet)
2040 msg_format("%ld¥´¡¼¥ë¥É¤À¤±¼õ¤±¤è¤¦¡£»Ä¤ê¤Ï¼è¤Ã¤È¤¤Ê¡£", maxbet);
2042 msg_format("I'll take %ld gold of that. Keep the rest.", maxbet);
2050 msg_print("£Ï£Ë¡¢£±¥´¡¼¥ë¥É¤Ç¤¤¤³¤¦¡£");
2052 msg_print("Ok, we'll start with 1 gold.");
2059 battle_odds = MAX(wager+1, wager * battle_odds / 100);
2062 p_ptr->leftbldg = TRUE;
2065 /* Save the surface floor to preserve pets */
2066 prepare_change_floor_mode(CFM_SAVE_SURFACE);
2068 p_ptr->inside_battle = TRUE;
2069 p_ptr->leaving = TRUE;
2082 static void today_target(void)
2085 monster_race *r_ptr = &r_info[today_mon];
2089 c_put_str(TERM_YELLOW, "ËÜÆü¤Î¾Þ¶â¼ó", 5, 10);
2091 prt("Wanted monster that changes from day to day", 5, 10);
2094 sprintf(buf,"¥¿¡¼¥²¥Ã¥È¡§ %s",r_name + r_ptr->name);
2096 sprintf(buf,"target: %s",r_name + r_ptr->name);
2098 c_put_str(TERM_YELLOW, buf, 6, 10);
2100 sprintf(buf,"»àÂÎ ---- $%d",r_ptr->level * 50 + 100);
2102 sprintf(buf,"corpse ---- $%d",r_ptr->level * 50 + 100);
2106 sprintf(buf,"¹ü ---- $%d",r_ptr->level * 30 + 60);
2108 sprintf(buf,"skeleton ---- $%d",r_ptr->level * 30 + 60);
2111 p_ptr->today_mon = today_mon;
2114 static void tsuchinoko(void)
2118 c_put_str(TERM_YELLOW, "°ì³ÍÀé¶â¤ÎÂç¥Á¥ã¥ó¥¹¡ª¡ª¡ª", 5, 10);
2119 c_put_str(TERM_YELLOW, "¥¿¡¼¥²¥Ã¥È¡§¸¸¤ÎÄÁ½Ã¡Ö¥Ä¥Á¥Î¥³¡×", 6, 10);
2120 c_put_str(TERM_WHITE, "À¸¤±Êá¤ê ---- $1,000,000", 8, 10);
2121 c_put_str(TERM_WHITE, "»àÂÎ ---- $200,000", 9, 10);
2122 c_put_str(TERM_WHITE, "¹ü ---- $100,000", 10, 10);
2124 c_put_str(TERM_YELLOW, "Big chance to quick money!!!", 5, 10);
2125 c_put_str(TERM_YELLOW, "target: the rarest animal 'Tsuchinoko'", 6, 10);
2126 c_put_str(TERM_WHITE, "catch alive ---- $1,000,000", 8, 10);
2127 c_put_str(TERM_WHITE, "corpse ---- $200,000", 9, 10);
2128 c_put_str(TERM_WHITE, "bones ---- $100,000", 10, 10);
2132 static void shoukinkubi(void)
2140 prt("»àÂΤò»ý¤Áµ¢¤ì¤ÐÊó½·¤òº¹¤·¾å¤²¤Þ¤¹¡£",4 ,10);
2141 c_put_str(TERM_YELLOW, "¸½ºß¤Î¾Þ¶â¼ó", 6, 10);
2143 prt("Offer a prize when you bring a wanted monster's corpse",4 ,10);
2144 c_put_str(TERM_YELLOW, "Wanted monsters", 6, 10);
2147 for (i = 0; i < MAX_KUBI; i++)
2151 monster_race *r_ptr = &r_info[(kubi_r_idx[i] > 10000 ? kubi_r_idx[i] - 10000 : kubi_r_idx[i])];
2153 if (kubi_r_idx[i] > 10000)
2159 done_mark = "(done)";
2168 c_prt(color, format("%s %s", r_name + r_ptr->name, done_mark), y+7, 10);
2171 if (!y && (i < MAX_KUBI -1))
2174 prt("²¿¤«¥¡¼¤ò²¡¤·¤Æ¤¯¤À¤µ¤¤", 0, 0);
2176 prt("Hit any key.", 0, 0);
2186 /* List of prize object */
2190 } prize_list[MAX_KUBI] =
2192 {TV_POTION, SV_POTION_CURING},
2193 {TV_POTION, SV_POTION_SPEED},
2194 {TV_POTION, SV_POTION_SPEED},
2195 {TV_POTION, SV_POTION_RESISTANCE},
2196 {TV_POTION, SV_POTION_ENLIGHTENMENT},
2198 {TV_POTION, SV_POTION_HEALING},
2199 {TV_POTION, SV_POTION_RESTORE_MANA},
2200 {TV_SCROLL, SV_SCROLL_STAR_DESTRUCTION},
2201 {TV_POTION, SV_POTION_STAR_ENLIGHTENMENT},
2202 {TV_SCROLL, SV_SCROLL_SUMMON_PET},
2204 {TV_SCROLL, SV_SCROLL_GENOCIDE},
2205 {TV_POTION, SV_POTION_STAR_HEALING},
2206 {TV_POTION, SV_POTION_STAR_HEALING},
2207 {TV_POTION, SV_POTION_NEW_LIFE},
2208 {TV_SCROLL, SV_SCROLL_MASS_GENOCIDE},
2210 {TV_POTION, SV_POTION_LIFE},
2211 {TV_POTION, SV_POTION_LIFE},
2212 {TV_POTION, SV_POTION_AUGMENTATION},
2213 {TV_POTION, SV_POTION_INVULNERABILITY},
2214 {TV_SCROLL, SV_SCROLL_ARTIFACT},
2219 static bool kankin(void)
2222 bool change = FALSE;
2223 char o_name[MAX_NLEN];
2226 /* Loop for inventory and right/left arm */
2227 for (i = 0; i <= INVEN_LARM; i++)
2229 o_ptr = &inventory[i];
2231 /* Living Tsuchinoko worthes $1000000 */
2232 if ((o_ptr->tval == TV_CAPTURE) && (o_ptr->pval == MON_TSUCHINOKO))
2234 char buf[MAX_NLEN+20];
2235 object_desc(o_name, o_ptr, TRUE, 3);
2237 sprintf(buf, "%s ¤ò´¹¶â¤·¤Þ¤¹¤«¡©",o_name);
2239 sprintf(buf, "Convert %s into money? ",o_name);
2244 msg_format("¾Þ¶â %ld¡ð¤ò¼ê¤ËÆþ¤ì¤¿¡£", 1000000L * o_ptr->number);
2246 msg_format("You get %ldgp.", 1000000L * o_ptr->number);
2248 p_ptr->au += 1000000L * o_ptr->number;
2249 p_ptr->redraw |= (PR_GOLD);
2250 inven_item_increase(i, -o_ptr->number);
2251 inven_item_describe(i);
2252 inven_item_optimize(i);
2258 for (i = 0; i < INVEN_PACK; i++)
2260 o_ptr = &inventory[i];
2262 /* Corpse of Tsuchinoko worthes $200000 */
2263 if ((o_ptr->tval == TV_CORPSE) && (o_ptr->sval == SV_CORPSE) && (o_ptr->pval == MON_TSUCHINOKO))
2265 char buf[MAX_NLEN+20];
2266 object_desc(o_name, o_ptr, TRUE, 3);
2268 sprintf(buf, "%s ¤ò´¹¶â¤·¤Þ¤¹¤«¡©",o_name);
2270 sprintf(buf, "Convert %s into money? ",o_name);
2275 msg_format("¾Þ¶â %ld¡ð¤ò¼ê¤ËÆþ¤ì¤¿¡£", 200000L * o_ptr->number);
2277 msg_format("You get %ldgp.", 200000L * o_ptr->number);
2279 p_ptr->au += 200000L * o_ptr->number;
2280 p_ptr->redraw |= (PR_GOLD);
2281 inven_item_increase(i, -o_ptr->number);
2282 inven_item_describe(i);
2283 inven_item_optimize(i);
2289 for (i = 0; i < INVEN_PACK; i++)
2291 o_ptr = &inventory[i];
2293 /* Bones of Tsuchinoko worthes $100000 */
2294 if ((o_ptr->tval == TV_CORPSE) && (o_ptr->sval == SV_SKELETON) && (o_ptr->pval == MON_TSUCHINOKO))
2296 char buf[MAX_NLEN+20];
2297 object_desc(o_name, o_ptr, TRUE, 3);
2299 sprintf(buf, "%s ¤ò´¹¶â¤·¤Þ¤¹¤«¡©",o_name);
2301 sprintf(buf, "Convert %s into money? ",o_name);
2306 msg_format("¾Þ¶â %ld¡ð¤ò¼ê¤ËÆþ¤ì¤¿¡£", 100000L * o_ptr->number);
2308 msg_format("You get %ldgp.", 100000L * o_ptr->number);
2310 p_ptr->au += 100000L * o_ptr->number;
2311 p_ptr->redraw |= (PR_GOLD);
2312 inven_item_increase(i, -o_ptr->number);
2313 inven_item_describe(i);
2314 inven_item_optimize(i);
2320 for (i = 0; i < INVEN_PACK; i++)
2322 o_ptr = &inventory[i];
2323 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)))
2325 char buf[MAX_NLEN+20];
2326 object_desc(o_name, o_ptr, TRUE, 3);
2328 sprintf(buf, "%s ¤ò´¹¶â¤·¤Þ¤¹¤«¡©",o_name);
2330 sprintf(buf, "Convert %s into money? ",o_name);
2335 msg_format("¾Þ¶â %ld¡ð¤ò¼ê¤ËÆþ¤ì¤¿¡£", (r_info[today_mon].level * 50 + 100) * o_ptr->number);
2337 msg_format("You get %ldgp.", (r_info[today_mon].level * 50 + 100) * o_ptr->number);
2339 p_ptr->au += (r_info[today_mon].level * 50 + 100) * o_ptr->number;
2340 p_ptr->redraw |= (PR_GOLD);
2341 inven_item_increase(i, -o_ptr->number);
2342 inven_item_describe(i);
2343 inven_item_optimize(i);
2349 for (i = 0; i < INVEN_PACK; i++)
2351 o_ptr = &inventory[i];
2353 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)))
2355 char buf[MAX_NLEN+20];
2356 object_desc(o_name, o_ptr, TRUE, 3);
2358 sprintf(buf, "%s ¤ò´¹¶â¤·¤Þ¤¹¤«¡©",o_name);
2360 sprintf(buf, "Convert %s into money? ",o_name);
2365 msg_format("¾Þ¶â %ld¡ð¤ò¼ê¤ËÆþ¤ì¤¿¡£", (r_info[today_mon].level * 30 + 60) * o_ptr->number);
2367 msg_format("You get %ldgp.", (r_info[today_mon].level * 30 + 60) * o_ptr->number);
2369 p_ptr->au += (r_info[today_mon].level * 30 + 60) * o_ptr->number;
2370 p_ptr->redraw |= (PR_GOLD);
2371 inven_item_increase(i, -o_ptr->number);
2372 inven_item_describe(i);
2373 inven_item_optimize(i);
2379 for (j = 0; j < MAX_KUBI; j++)
2381 /* Need reverse order --- Positions will be changed in the loop */
2382 for (i = INVEN_PACK-1; i >= 0; i--)
2384 o_ptr = &inventory[i];
2385 if ((o_ptr->tval == TV_CORPSE) && (o_ptr->pval == kubi_r_idx[j]))
2387 char buf[MAX_NLEN+20];
2391 object_desc(o_name, o_ptr, TRUE, 3);
2393 sprintf(buf, "%s¤òÅϤ·¤Þ¤¹¤«¡©",o_name);
2395 sprintf(buf, "Hand %s over? ",o_name);
2397 if (!get_check(buf)) continue;
2399 #if 0 /* Obsorated */
2401 msg_format("¾Þ¶â %ld¡ð¤ò¼ê¤ËÆþ¤ì¤¿¡£", (r_info[kubi_r_idx[j]].level + 1) * 300 * o_ptr->number);
2403 msg_format("You get %ldgp.", (r_info[kubi_r_idx[j]].level + 1) * 300 * o_ptr->number);
2405 p_ptr->au += (r_info[kubi_r_idx[j]].level+1) * 300 * o_ptr->number;
2406 p_ptr->redraw |= (PR_GOLD);
2407 inven_item_increase(i, -o_ptr->number);
2408 inven_item_describe(i);
2409 inven_item_optimize(i);
2410 chg_virtue(V_JUSTICE, 5);
2411 kubi_r_idx[j] += 10000;
2414 #endif /* Obsorated */
2417 inven_item_increase(i, -o_ptr->number);
2418 inven_item_describe(i);
2419 inven_item_optimize(i);
2421 chg_virtue(V_JUSTICE, 5);
2422 kubi_r_idx[j] += 10000;
2424 /* Count number of unique corpses already handed */
2425 for (num = 0, k = 0; k < MAX_KUBI; k++)
2427 if (kubi_r_idx[k] >= 10000) num++;
2431 msg_format("¤³¤ì¤Ç¹ç·× %d ¥Ý¥¤¥ó¥È³ÍÆÀ¤·¤Þ¤·¤¿¡£", num);
2433 msg_format("You earned %d point%s total.", num, (num > 1 ? "s" : ""));
2436 /* Prepare to make a prize */
2437 object_prep(&forge, lookup_kind(prize_list[num-1].tval, prize_list[num-1].sval));
2438 apply_magic(&forge, object_level, AM_NO_FIXED_ART);
2440 /* Identify it fully */
2441 object_aware(&forge);
2442 object_known(&forge);
2445 * Hand it --- Assume there is an empty slot.
2446 * Since a corpse is handed at first,
2447 * there is at least one empty slot.
2449 (void)inven_carry(&forge);
2451 /* Describe the object */
2452 object_desc(o_name, &forge, TRUE, 3);
2454 msg_format("%s ¤òÌã¤Ã¤¿¡£",o_name);
2456 msg_format("You get %s. ",o_name);
2467 msg_print("¾Þ¶â¤òÆÀ¤é¤ì¤½¤¦¤Ê¤â¤Î¤Ï»ý¤Ã¤Æ¤¤¤Ê¤«¤Ã¤¿¡£");
2469 msg_print("You have nothing.");
2477 bool get_nightmare(int r_idx)
2479 monster_race *r_ptr = &r_info[r_idx];
2481 /* Require eldritch horrors */
2482 if (!(r_ptr->flags2 & (RF2_ELDRITCH_HORROR))) return (FALSE);
2484 /* Require high level */
2485 if (r_ptr->level <= p_ptr->lev) return (FALSE);
2487 /* Accept this monster */
2492 void have_nightmare(int r_idx)
2494 bool happened = FALSE;
2495 monster_race *r_ptr = &r_info[r_idx];
2496 int power = r_ptr->level + 10;
2498 cptr desc = r_name + r_ptr->name;
2502 if (!(r_ptr->flags1 & RF1_UNIQUE))
2503 sprintf(m_name, "%s %s", (is_a_vowel(desc[0]) ? "an" : "a"), desc);
2506 sprintf(m_name, "%s", desc);
2508 if (!(r_ptr->flags1 & RF1_UNIQUE))
2510 if (r_ptr->flags1 & RF1_FRIENDS) power /= 2;
2514 if (saving_throw(p_ptr->skill_sav * 100 / power))
2517 msg_format("Ì´¤ÎÃæ¤Ç%s¤ËÄɤ¤¤«¤±¤é¤ì¤¿¡£", m_name);
2519 msg_format("%^s chases you through your dreams.", m_name);
2528 /* Something silly happens... */
2530 msg_format("%s%s¤Î´é¤ò¸«¤Æ¤·¤Þ¤Ã¤¿¡ª",
2532 msg_format("You behold the %s visage of %s!",
2535 funny_desc[randint0(MAX_SAN_FUNNY)], m_name);
2539 msg_print(funny_comments[randint0(MAX_SAN_COMMENT)]);
2540 p_ptr->image = p_ptr->image + randint1(r_ptr->level);
2543 /* Never mind; we can't see it clearly enough */
2547 /* Something frightening happens... */
2549 msg_format("%s%s¤Î´é¤ò¸«¤Æ¤·¤Þ¤Ã¤¿¡ª",
2551 msg_format("You behold the %s visage of %s!",
2554 horror_desc[randint0(MAX_SAN_HORROR)], desc);
2556 r_ptr->r_flags2 |= RF2_ELDRITCH_HORROR;
2558 if (!p_ptr->mimic_form)
2560 switch (p_ptr->prace)
2562 /* Demons may make a saving throw */
2565 if (saving_throw(20 + p_ptr->lev)) return;
2567 /* Undead may make a saving throw */
2572 if (saving_throw(10 + p_ptr->lev)) return;
2578 /* Demons may make a saving throw */
2579 if (mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_DEMON)
2581 if (saving_throw(20 + p_ptr->lev)) return;
2583 /* Undead may make a saving throw */
2584 else if (mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_UNDEAD)
2586 if (saving_throw(10 + p_ptr->lev)) return;
2591 if (!saving_throw(p_ptr->skill_sav * 100 / power))
2593 if (!p_ptr->resist_conf)
2595 (void)set_confused(p_ptr->confused + randint0(4) + 4);
2597 if (!p_ptr->resist_chaos && one_in_(3))
2599 (void)set_image(p_ptr->image + randint0(250) + 150);
2604 /* Lose int & wis */
2605 if (!saving_throw(p_ptr->skill_sav * 100 / power))
2613 if (!saving_throw(p_ptr->skill_sav * 100 / power))
2615 if (!p_ptr->resist_conf)
2617 (void)set_confused(p_ptr->confused + randint0(4) + 4);
2619 if (!p_ptr->free_act)
2621 (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
2623 while (!saving_throw(p_ptr->skill_sav))
2625 (void)do_dec_stat(A_INT);
2627 while (!saving_throw(p_ptr->skill_sav))
2629 (void)do_dec_stat(A_WIS);
2631 if (!p_ptr->resist_chaos)
2633 (void)set_image(p_ptr->image + randint0(250) + 150);
2640 if (!saving_throw(p_ptr->skill_sav * 100 / power))
2642 if (lose_all_info())
2645 msg_print("¤¢¤Þ¤ê¤Î¶²ÉݤËÁ´¤Æ¤Î¤³¤È¤ò˺¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª");
2647 msg_print("You forget everything in your utmost terror!");
2654 /* Else gain permanent insanity */
2655 if ((p_ptr->muta3 & MUT3_MORONIC) && (p_ptr->muta2 & MUT2_BERS_RAGE) &&
2656 ((p_ptr->muta2 & MUT2_COWARDICE) || (p_ptr->resist_fear)) &&
2657 ((p_ptr->muta2 & MUT2_HALLU) || (p_ptr->resist_chaos)))
2659 /* The poor bastard already has all possible insanities! */
2665 switch (randint1(4))
2669 if (!(p_ptr->muta3 & MUT3_MORONIC))
2671 if ((p_ptr->stat_use[A_INT] < 4) && (p_ptr->stat_use[A_WIS] < 4))
2674 msg_print("¤¢¤Ê¤¿¤Ï´°àú¤ÊÇϼ¯¤Ë¤Ê¤Ã¤¿¤è¤¦¤Êµ¤¤¬¤·¤¿¡£¤·¤«¤·¤½¤ì¤Ï¸µ¡¹¤À¤Ã¤¿¡£");
2676 msg_print("You turn into an utter moron!");
2682 msg_print("¤¢¤Ê¤¿¤Ï´°àú¤ÊÇϼ¯¤Ë¤Ê¤Ã¤¿¡ª");
2684 msg_print("You turn into an utter moron!");
2688 if (p_ptr->muta3 & MUT3_HYPER_INT)
2691 msg_print("¤¢¤Ê¤¿¤ÎǾ¤ÏÀ¸ÂÎ¥³¥ó¥Ô¥å¡¼¥¿¤Ç¤Ï¤Ê¤¯¤Ê¤Ã¤¿¡£");
2693 msg_print("Your brain is no longer a living computer.");
2696 p_ptr->muta3 &= ~(MUT3_HYPER_INT);
2698 p_ptr->muta3 |= MUT3_MORONIC;
2705 if (!(p_ptr->muta2 & MUT2_COWARDICE) && !p_ptr->resist_fear)
2708 msg_print("¤¢¤Ê¤¿¤Ï¥Ñ¥é¥Î¥¤¥¢¤Ë¤Ê¤Ã¤¿¡ª");
2710 msg_print("You become paranoid!");
2714 /* Duh, the following should never happen, but anyway... */
2715 if (p_ptr->muta3 & MUT3_FEARLESS)
2718 msg_print("¤¢¤Ê¤¿¤Ï¤â¤¦¶²¤ìÃΤ餺¤Ç¤Ï¤Ê¤¯¤Ê¤Ã¤¿¡£");
2720 msg_print("You are no longer fearless.");
2723 p_ptr->muta3 &= ~(MUT3_FEARLESS);
2726 p_ptr->muta2 |= MUT2_COWARDICE;
2733 if (!(p_ptr->muta2 & MUT2_HALLU) && !p_ptr->resist_chaos)
2736 msg_print("¸¸³Ð¤ò¤Ò¤µ¯¤³¤¹Àº¿ÀºøÍð¤Ë´Ù¤Ã¤¿¡ª");
2738 msg_print("You are afflicted by a hallucinatory insanity!");
2741 p_ptr->muta2 |= MUT2_HALLU;
2748 if (!(p_ptr->muta2 & MUT2_BERS_RAGE))
2751 msg_print("·ãÎõ¤Ê´¶¾ð¤Îȯºî¤Ë¤ª¤½¤ï¤ì¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¡ª");
2753 msg_print("You become subject to fits of berserk rage!");
2756 p_ptr->muta2 |= MUT2_BERS_RAGE;
2764 p_ptr->update |= PU_BONUS;
2771 * Note that resting for the night was a perfect way to avoid player
2772 * ghosts in the town *if* you could only make it to the inn in time (-:
2773 * Now that the ghosts are temporarily disabled in 2.8.X, this function
2774 * will not be that useful. I will keep it in the hopes the player
2775 * ghost code does become a reality again. Does help to avoid filthy urchins.
2776 * Resting at night is also a quick way to restock stores -KMW-
2778 static bool inn_comm(int cmd)
2782 case BACT_FOOD: /* Buy food & drink */
2783 if (p_ptr->food >= PY_FOOD_FULL)
2786 msg_print("º£¤ÏËþÊ¢¤À¡£");
2788 msg_print("You are full now.");
2794 msg_print("¥Ð¡¼¥Æ¥ó¤Ï¤¤¤¯¤é¤«¤Î¿©¤Ùʪ¤È¥Ó¡¼¥ë¤ò¤¯¤ì¤¿¡£");
2796 msg_print("The barkeep gives you some gruel and a beer.");
2799 (void)set_food(PY_FOOD_MAX - 1);
2802 case BACT_REST: /* Rest for the night */
2803 if ((p_ptr->poisoned) || (p_ptr->cut))
2806 msg_print("¤¢¤Ê¤¿¤ËɬÍפʤΤÏÉô²°¤Ç¤Ï¤Ê¤¯¡¢¼£ÎżԤǤ¹¡£");
2808 msg_print("You need a healer, not a room.");
2813 msg_print("¤¹¤ß¤Þ¤»¤ó¡¢¤Ç¤â¤¦¤Á¤Ç狼¤Ë»à¤Ê¤ì¤Á¤ãº¤¤ê¤Þ¤¹¤ó¤Ç¡£");
2815 msg_print("Sorry, but don't want anyone dying in here.");
2821 int prev_day, prev_hour, prev_min;
2823 extract_day_hour_min(&prev_day, &prev_hour, &prev_min);
2825 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "½É²°¤ËÇñ¤Þ¤Ã¤¿¡£");
2827 if ((prev_hour >= 6) && (prev_hour <= 17)) do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "stay over daytime at the inn.");
2828 else do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "stay over night at the inn.");
2830 turn = (turn / (TURNS_PER_TICK*TOWN_DAWN/2) + 1) * (TURNS_PER_TICK*TOWN_DAWN/2);
2831 if ((prev_hour >= 18) && (prev_hour <= 23)) do_cmd_write_nikki(NIKKI_HIGAWARI, 0, NULL);
2832 p_ptr->chp = p_ptr->mhp;
2834 dungeon_turn += MIN(turn - oldturn, TURNS_PER_TICK*250);
2836 if (ironman_nightmare)
2839 msg_print("̲¤ê¤Ë½¢¤¯¤È¶²¤í¤·¤¤¸÷·Ê¤¬¿´¤ò¤è¤®¤Ã¤¿¡£");
2841 msg_print("Horrible visions flit through your mind as you sleep.");
2844 /* Pick a nightmare */
2845 get_mon_num_prep(get_nightmare, NULL);
2847 /* Have some nightmares */
2850 have_nightmare(get_mon_num(MAX_DEPTH));
2852 if (!one_in_(3)) break;
2855 /* Remove the monster restriction */
2856 get_mon_num_prep(NULL, NULL);
2859 msg_print("¤¢¤Ê¤¿¤ÏÀ䶫¤·¤ÆÌܤò³Ð¤Þ¤·¤¿¡£");
2860 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "°Ì´¤Ë¤¦¤Ê¤µ¤ì¤Æ¤è¤¯Ì²¤ì¤Ê¤«¤Ã¤¿¡£");
2862 msg_print("You awake screaming.");
2863 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "be troubled by a nightmare.");
2871 p_ptr->chp = p_ptr->mhp;
2872 p_ptr->csp = p_ptr->msp;
2873 if (p_ptr->pclass == CLASS_MAGIC_EATER)
2876 for (i = 0; i < 72; i++)
2878 p_ptr->magic_num1[i] = p_ptr->magic_num2[i]*EATER_CHARGE;
2880 for (; i < 108; i++)
2882 p_ptr->magic_num1[i] = 0;
2886 if ((prev_hour >= 6) && (prev_hour <= 17))
2889 msg_print("¤¢¤Ê¤¿¤Ï¥ê¥Õ¥ì¥Ã¥·¥å¤·¤ÆÌܳФᡢͼÊý¤ò·Þ¤¨¤¿¡£");
2890 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "ͼÊý¤ò·Þ¤¨¤¿¡£");
2892 msg_print("You awake refreshed for the evening.");
2893 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "awake refreshed.");
2899 msg_print("¤¢¤Ê¤¿¤Ï¥ê¥Õ¥ì¥Ã¥·¥å¤·¤ÆÌܳФᡢ¿·¤¿¤ÊÆü¤ò·Þ¤¨¤¿¡£");
2900 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "¤¹¤¬¤¹¤¬¤·¤¤Ä«¤ò·Þ¤¨¤¿¡£");
2902 msg_print("You awake refreshed for the new day.");
2903 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "awake refreshed.");
2908 p_ptr->leftbldg = TRUE;
2912 case BACT_RUMORS: /* Listen for rumors */
2917 if (!get_rnd_line_jonly("rumors_j.txt", 0, Rumor, 10))
2919 if (!get_rnd_line("rumors.txt", 0, Rumor))
2922 msg_format("%s", Rumor);
2932 * Share gold for thieves
2934 static void share_gold(void)
2936 int i = (p_ptr->lev * 2) * 10;
2938 msg_format("¡ð%d ¤ò¼ê¤ËÆþ¤ì¤¿¡£", i);
2940 msg_format("You collect %d gold pieces", i);
2948 * Display quest information
2950 static void get_questinfo(int questnum)
2957 /* Clear the text */
2958 for (i = 0; i < 10; i++)
2960 quest_text[i][0] = '\0';
2963 quest_text_line = 0;
2965 /* Set the quest number temporary */
2966 old_quest = p_ptr->inside_quest;
2967 p_ptr->inside_quest = questnum;
2969 /* Get the quest text */
2970 init_flags = INIT_SHOW_TEXT | INIT_ASSIGN;
2972 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
2974 /* Reset the old quest number */
2975 p_ptr->inside_quest = old_quest;
2977 /* Print the quest info */
2979 sprintf(tmp_str, "¥¯¥¨¥¹¥È¾ðÊó (´í¸±ÅÙ: %d ³¬ÁêÅö)", quest[questnum].level);
2981 sprintf(tmp_str, "Quest Information (Danger level: %d)", quest[questnum].level);
2986 prt(quest[questnum].name, 7, 0);
2988 for (i = 0; i < 10; i++)
2990 c_put_str(TERM_YELLOW, quest_text[i], i + 8, 0);
2996 * Request a quest from the Lord.
2998 static void castle_quest(void)
3001 monster_race *r_ptr;
3008 /* Current quest of the building */
3009 q_index = cave[py][px].special;
3011 /* Is there a quest available at the building? */
3015 put_str("º£¤Î¤È¤³¤í¥¯¥¨¥¹¥È¤Ï¤¢¤ê¤Þ¤»¤ó¡£", 8, 0);
3017 put_str("I don't have a quest for you at the moment.", 8, 0);
3023 q_ptr = &quest[q_index];
3025 /* Quest is completed */
3026 if (q_ptr->status == QUEST_STATUS_COMPLETED)
3028 /* Rewarded quest */
3029 q_ptr->status = QUEST_STATUS_REWARDED;
3031 get_questinfo(q_index);
3033 reinit_wilderness = TRUE;
3036 else if (q_ptr->status == QUEST_STATUS_FAILED)
3038 get_questinfo(q_index);
3040 /* Mark quest as done (but failed) */
3041 q_ptr->status = QUEST_STATUS_FAILED_DONE;
3043 reinit_wilderness = TRUE;
3045 /* Quest is still unfinished */
3046 else if (q_ptr->status == QUEST_STATUS_TAKEN)
3049 put_str("¤¢¤Ê¤¿¤Ï¸½ºß¤Î¥¯¥¨¥¹¥È¤ò½ªÎ»¤µ¤»¤Æ¤¤¤Þ¤»¤ó¡ª", 8, 0);
3051 put_str("You have not completed your current quest yet!", 8, 0);
3055 put_str("CTRL-Q¤ò»È¤¨¤Ð¥¯¥¨¥¹¥È¤Î¾õÂÖ¤¬¥Á¥§¥Ã¥¯¤Ç¤¤Þ¤¹¡£", 9, 0);
3057 put_str("Use CTRL-Q to check the status of your quest.", 9, 0);
3061 put_str("¥¯¥¨¥¹¥È¤ò½ª¤ï¤é¤»¤¿¤éÌá¤Ã¤ÆÍè¤Æ²¼¤µ¤¤¡£", 12, 0);
3063 put_str("Return when you have completed your quest.", 12, 0);
3068 else if (q_ptr->status == QUEST_STATUS_UNTAKEN)
3070 q_ptr->status = QUEST_STATUS_TAKEN;
3072 reinit_wilderness = TRUE;
3074 /* Assign a new quest */
3075 if (q_ptr->type == QUEST_TYPE_KILL_ANY_LEVEL)
3077 if (q_ptr->r_idx == 0)
3079 /* Random monster at least 5 - 10 levels out of deep */
3080 q_ptr->r_idx = get_mon_num(q_ptr->level + 4 + randint1(6));
3083 r_ptr = &r_info[q_ptr->r_idx];
3085 while ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->rarity != 1))
3087 q_ptr->r_idx = get_mon_num(q_ptr->level) + 4 + randint1(6);
3088 r_ptr = &r_info[q_ptr->r_idx];
3091 if (q_ptr->max_num == 0)
3093 /* Random monster number */
3094 if (randint1(10) > 7)
3097 q_ptr->max_num = randint1(3) + 1;
3101 name = (r_name + r_ptr->name);
3103 msg_format("¥¯¥¨¥¹¥È: %s¤ò %dÂÎÅݤ¹", name,q_ptr->max_num);
3105 msg_format("Your quest: kill %d %s", q_ptr->max_num, name);
3111 get_questinfo(q_index);
3118 * Display town history
3120 static void town_history(void)
3125 /* Peruse the building help file */
3127 (void)show_file(TRUE, "jbldg.txt", NULL, 0, 0);
3129 (void)show_file(TRUE, "bldg.txt", NULL, 0, 0);
3139 * Display the damage figure of an object
3140 * (used by compare_weapon_aux1)
3142 * Only accurate for the current weapon, because it includes
3143 * the current +dam of the player.
3145 static void compare_weapon_aux2(object_type *o_ptr, int numblows,
3146 int r, int c, int mult, cptr attr,
3151 /* Effective dices */
3152 int eff_dd = o_ptr->dd + p_ptr->to_dd[0];
3153 int eff_ds = o_ptr->ds + p_ptr->to_ds[0];
3155 /* Print the intro text */
3156 c_put_str(color, attr, r, c);
3158 /* Calculate the min and max damage figures */
3160 sprintf(tmp_str, "£±¥¿¡¼¥ó: %d-%d ¥À¥á¡¼¥¸",
3162 sprintf(tmp_str, "Attack: %d-%d damage",
3165 (numblows * (mult * eff_dd / 60 + o_ptr->to_d + p_ptr->to_d[0])),
3166 (numblows * (mult * eff_ds * eff_dd / 60 + o_ptr->to_d + p_ptr->to_d[0])));
3168 /* Print the damage */
3169 put_str(tmp_str, r, c + 8);
3174 * Show the damage figures for the various monster types
3176 * Only accurate for the current weapon, because it includes
3177 * the current number of blows for the player.
3179 static void compare_weapon_aux1(object_type *o_ptr, int col, int r)
3182 u32b flgs[TR_FLAG_SIZE];
3183 int blow = p_ptr->num_blow[0];
3184 bool print_force_weapon = FALSE;
3186 /* Get the flags of the weapon */
3187 object_flags(o_ptr, flgs);
3189 if ((p_ptr->pclass != CLASS_SAMURAI) && have_flag(flgs, TR_FORCE_WEAPON) && (p_ptr->csp > (o_ptr->dd * o_ptr->ds / 5)))
3191 mult = mult * 7 / 2;
3192 print_force_weapon = TRUE;
3195 /* Print the relevant lines */
3197 if (print_force_weapon) compare_weapon_aux2(o_ptr, blow, r++, col, 1*mult, "ÍýÎÏ:", TERM_L_BLUE);
3198 if (have_flag(flgs, TR_KILL_ANIMAL)) compare_weapon_aux2(o_ptr, blow, r++, col, 4*mult, "ưʪ:", TERM_YELLOW);
3199 else if (have_flag(flgs, TR_SLAY_ANIMAL)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "ưʪ:", TERM_YELLOW);
3200 if (have_flag(flgs, TR_KILL_EVIL)) compare_weapon_aux2(o_ptr, blow, r++, col, 7*mult/2, "¼Ù°:", TERM_YELLOW);
3201 else if (have_flag(flgs, TR_SLAY_EVIL)) compare_weapon_aux2(o_ptr, blow, r++, col, 2*mult, "¼Ù°:", TERM_YELLOW);
3202 if (have_flag(flgs, TR_KILL_HUMAN)) compare_weapon_aux2(o_ptr, blow, r++, col, 4*mult, "¿Í´Ö:", TERM_YELLOW);
3203 else if (have_flag(flgs, TR_SLAY_HUMAN)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "¿Í´Ö:", TERM_YELLOW);
3204 if (have_flag(flgs, TR_KILL_UNDEAD)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "ÉÔ»à:", TERM_YELLOW);
3205 else if (have_flag(flgs, TR_SLAY_UNDEAD)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "ÉÔ»à:", TERM_YELLOW);
3206 if (have_flag(flgs, TR_KILL_DEMON)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "°Ëâ:", TERM_YELLOW);
3207 else if (have_flag(flgs, TR_SLAY_DEMON)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "°Ëâ:", TERM_YELLOW);
3208 if (have_flag(flgs, TR_KILL_ORC)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "¥ª¡¼¥¯:", TERM_YELLOW);
3209 else if (have_flag(flgs, TR_SLAY_ORC)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "¥ª¡¼¥¯:", TERM_YELLOW);
3210 if (have_flag(flgs, TR_KILL_TROLL)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "¥È¥í¥ë:", TERM_YELLOW);
3211 else if (have_flag(flgs, TR_SLAY_TROLL)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "¥È¥í¥ë:", TERM_YELLOW);
3212 if (have_flag(flgs, TR_KILL_GIANT)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "µð¿Í:", TERM_YELLOW);
3213 else if (have_flag(flgs, TR_SLAY_GIANT)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "µð¿Í:", TERM_YELLOW);
3214 if (have_flag(flgs, TR_KILL_DRAGON)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "ε:", TERM_YELLOW);
3215 else if (have_flag(flgs, TR_SLAY_DRAGON)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "ε:", TERM_YELLOW);
3216 if (have_flag(flgs, TR_BRAND_ACID)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "»À°À:", TERM_RED);
3217 if (have_flag(flgs, TR_BRAND_ELEC)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "ÅÅ°À:", TERM_RED);
3218 if (have_flag(flgs, TR_BRAND_FIRE)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "±ê°À:", TERM_RED);
3219 if (have_flag(flgs, TR_BRAND_COLD)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "Îä°À:", TERM_RED);
3220 if (have_flag(flgs, TR_BRAND_POIS)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "ÆÇ°À:", TERM_RED);
3222 if (print_force_weapon) compare_weapon_aux2(o_ptr, blow, r++, col, 1*mult, "Force :", TERM_L_BLUE);
3223 if (have_flag(flgs, TR_KILL_ANIMAL)) compare_weapon_aux2(o_ptr, blow, r++, col, 4*mult, "Animals:", TERM_YELLOW);
3224 else if (have_flag(flgs, TR_SLAY_ANIMAL)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "Animals:", TERM_YELLOW);
3225 if (have_flag(flgs, TR_KILL_EVIL)) compare_weapon_aux2(o_ptr, blow, r++, col, 7*mult/2, "Evil:", TERM_YELLOW);
3226 else if (have_flag(flgs, TR_SLAY_EVIL)) compare_weapon_aux2(o_ptr, blow, r++, col, 2*mult, "Evil:", TERM_YELLOW);
3227 if (have_flag(flgs, TR_KILL_HUMAN)) compare_weapon_aux2(o_ptr, blow, r++, col, 4*mult, "Human:", TERM_YELLOW);
3228 else if (have_flag(flgs, TR_SLAY_HUMAN)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "Human:", TERM_YELLOW);
3229 if (have_flag(flgs, TR_KILL_UNDEAD)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "Undead:", TERM_YELLOW);
3230 else if (have_flag(flgs, TR_SLAY_UNDEAD)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "Undead:", TERM_YELLOW);
3231 if (have_flag(flgs, TR_KILL_DEMON)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "Demons:", TERM_YELLOW);
3232 else if (have_flag(flgs, TR_SLAY_DEMON)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "Demons:", TERM_YELLOW);
3233 if (have_flag(flgs, TR_KILL_ORC)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "Orcs:", TERM_YELLOW);
3234 else if (have_flag(flgs, TR_SLAY_ORC)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "Orcs:", TERM_YELLOW);
3235 if (have_flag(flgs, TR_KILL_TROLL)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "Trolls:", TERM_YELLOW);
3236 else if (have_flag(flgs, TR_SLAY_TROLL)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "Trolls:", TERM_YELLOW);
3237 if (have_flag(flgs, TR_KILL_GIANT)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "Giants:", TERM_YELLOW);
3238 else if (have_flag(flgs, TR_SLAY_GIANT)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "Giants:", TERM_YELLOW);
3239 if (have_flag(flgs, TR_KILL_DRAGON)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "Dragons:", TERM_YELLOW);
3240 else if (have_flag(flgs, TR_SLAY_DRAGON)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "Dragons:", TERM_YELLOW);
3241 if (have_flag(flgs, TR_BRAND_ACID)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "Acid:", TERM_RED);
3242 if (have_flag(flgs, TR_BRAND_ELEC)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "Elec:", TERM_RED);
3243 if (have_flag(flgs, TR_BRAND_FIRE)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "Fire:", TERM_RED);
3244 if (have_flag(flgs, TR_BRAND_COLD)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "Cold:", TERM_RED);
3245 if (have_flag(flgs, TR_BRAND_POIS)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "Poison:", TERM_RED);
3250 static int hit_chance(int to_h, int ac)
3253 int meichuu = p_ptr->skill_thn + (p_ptr->to_h[0] + to_h) * BTH_PLUS_ADJ;
3255 if (meichuu <= 0) return 5;
3257 chance = 100 - ((ac * 75) / meichuu);
3259 if (chance > 95) chance = 95;
3260 if (chance < 5) chance = 5;
3261 if (p_ptr->pseikaku == SEIKAKU_NAMAKE)
3262 chance = (chance*19+9)/20;
3267 * Displays all info about a weapon
3269 * Only accurate for the current weapon, because it includes
3270 * various info about the player's +to_dam and number of blows.
3272 static void list_weapon(object_type *o_ptr, int row, int col)
3274 char o_name[MAX_NLEN];
3277 /* Effective dices */
3278 int eff_dd = o_ptr->dd + p_ptr->to_dd[0];
3279 int eff_ds = o_ptr->ds + p_ptr->to_ds[0];
3281 /* Print the weapon name */
3282 object_desc(o_name, o_ptr, TRUE, 0);
3283 c_put_str(TERM_YELLOW, o_name, row, col);
3285 /* Print the player's number of blows */
3287 sprintf(tmp_str, "¹¶·â²ó¿ô: %d", p_ptr->num_blow[0]);
3289 sprintf(tmp_str, "Number of Blows: %d", p_ptr->num_blow[0]);
3292 put_str(tmp_str, row+1, col);
3294 /* Print to_hit and to_dam of the weapon */
3296 sprintf(tmp_str, "Ì¿ÃæΨ: 0 50 100 150 200 (Ũ¤ÎAC)");
3298 sprintf(tmp_str, "To Hit: 0 50 100 150 200 (AC)");
3301 put_str(tmp_str, row+2, col);
3303 /* Print the weapons base damage dice */
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));
3307 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));
3310 put_str(tmp_str, row+3, col);
3313 c_put_str(TERM_YELLOW, "²Äǽ¤Ê¥À¥á¡¼¥¸:", row+5, col);
3315 c_put_str(TERM_YELLOW, "Possible Damage:", row+5, col);
3319 /* Damage for one blow (if it hits) */
3321 sprintf(tmp_str, "¹¶·â°ì²ó¤Ë¤Ä¤ %d-%d",
3323 sprintf(tmp_str, "One Strike: %d-%d damage",
3326 eff_dd + o_ptr->to_d + p_ptr->to_d[0],
3327 eff_ds * eff_dd + o_ptr->to_d + p_ptr->to_d[0]);
3328 put_str(tmp_str, row+6, col+1);
3330 /* Damage for the complete attack (if all blows hit) */
3332 sprintf(tmp_str, "£±¥¿¡¼¥ó¤Ë¤Ä¤ %d-%d",
3334 sprintf(tmp_str, "One Attack: %d-%d damage",
3337 p_ptr->num_blow[0] * (eff_dd + o_ptr->to_d + p_ptr->to_d[0]),
3338 p_ptr->num_blow[0] * (eff_ds * eff_dd + o_ptr->to_d + p_ptr->to_d[0]));
3339 put_str(tmp_str, row+7, col+1);
3344 * Hook to specify "weapon"
3346 static bool item_tester_hook_melee_weapon(object_type *o_ptr)
3348 switch (o_ptr->tval)
3358 if (o_ptr->sval != SV_DOKUBARI) return (TRUE);
3367 * Hook to specify "ammo"
3369 static bool item_tester_hook_ammo(object_type *o_ptr)
3371 switch (o_ptr->tval)
3388 * Copies the weapons to compare into the weapon-slot and
3389 * compares the values for both weapons.
3391 static bool compare_weapons(void)
3394 object_type *o1_ptr, *o2_ptr;
3395 object_type orig_weapon;
3399 bool old_character_xtra = character_xtra;
3402 /* Clear the screen */
3405 /* Store copy of original wielded weapon */
3406 i_ptr = &inventory[INVEN_RARM];
3407 object_copy(&orig_weapon, i_ptr);
3409 item_tester_no_ryoute = TRUE;
3410 /* Only compare melee weapons */
3411 item_tester_hook = item_tester_hook_melee_weapon;
3413 /* Get the first weapon */
3415 q = "Âè°ì¤ÎÉð´ï¤Ï¡©";
3416 s = "Èæ¤Ù¤ë¤â¤Î¤¬¤¢¤ê¤Þ¤»¤ó¡£";
3418 q = "What is your first weapon? ";
3419 s = "You have nothing to compare.";
3422 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN)))
3428 /* Get the item (in the pack) */
3429 o1_ptr = &inventory[item];
3431 /* Clear the screen */
3434 item_tester_no_ryoute = TRUE;
3435 /* Only compare melee weapons */
3436 item_tester_hook = item_tester_hook_melee_weapon;
3438 /* Get the second weapon */
3440 q = "ÂèÆó¤ÎÉð´ï¤Ï¡©";
3441 s = "Èæ¤Ù¤ë¤â¤Î¤¬¤¢¤ê¤Þ¤»¤ó¡£";
3443 q = "What is your second weapon? ";
3444 s = "You have nothing to compare.";
3447 if (!get_item(&item2, q, s, (USE_EQUIP | USE_INVEN)))
3453 /* Get the item (in the pack) */
3454 o2_ptr = &inventory[item2];
3456 /* Clear the screen */
3459 /* Copy first weapon into the weapon slot (if it's not already there) */
3460 if (o1_ptr != i_ptr)
3461 object_copy(i_ptr, o1_ptr);
3463 /* Hack -- prevent "icky" message */
3464 character_xtra = TRUE;
3466 /* Get the new values */
3469 character_xtra = old_character_xtra;
3471 /* List the new values */
3472 list_weapon(o1_ptr, row, 2);
3473 compare_weapon_aux1(o1_ptr, 2, row + 8);
3475 /* Copy second weapon into the weapon slot (if it's not already there) */
3476 if (o2_ptr != i_ptr)
3477 object_copy(i_ptr, o2_ptr);
3479 object_copy(i_ptr, &orig_weapon);
3481 /* Hack -- prevent "icky" message */
3482 character_xtra = TRUE;
3484 /* Get the new values */
3487 character_xtra = old_character_xtra;
3489 /* List the new values */
3490 list_weapon(o2_ptr, row, 40);
3491 compare_weapon_aux1(o2_ptr, 40, row + 8);
3493 /* Copy back the original weapon into the weapon slot */
3494 object_copy(i_ptr, &orig_weapon);
3496 /* Reset the values for the old weapon */
3500 put_str("(°ìÈֹ⤤¥À¥á¡¼¥¸¤¬Å¬ÍѤµ¤ì¤Þ¤¹¡£Ê£¿ô¤ÎÇÜÂǸú²Ì¤Ï¤·»»¤µ¤ì¤Þ¤»¤ó¡£)", row + 4, 0);
3502 put_str("(Only highest damage applies per monster. Special damage not cumulative.)", row + 4, 0);
3506 msg_print("¸½ºß¤Îµ»Î̤«¤éȽÃǤ¹¤ë¤È¡¢¤¢¤Ê¤¿¤ÎÉð´ï¤Ï°Ê²¼¤Î¤è¤¦¤Ê°ÒÎϤòȯ´ø¤·¤Þ¤¹:");
3508 msg_print("Based on your current abilities, here is what your weapons will do");
3524 * AC¤«¤é²óÈòΨ¡¢¥À¥á¡¼¥¸¸º¾¯Î¨¤ò·×»»¤·É½¼¨¤¹¤ë
3525 * Calculate and display the dodge-rate and the protection-rate
3528 static bool eval_ac(int iAC)
3532 "¥À¥á¡¼¥¸·Ú¸ºÎ¨¤È¤Ï¡¢Å¨¤Î¹¶·â¤¬Åö¤¿¤Ã¤¿»þ¤½¤Î¥À¥á¡¼¥¸¤ò\n"
3533 "²¿¥Ñ¡¼¥»¥ó¥È·Ú¸º¤¹¤ë¤«¤ò¼¨¤·¤Þ¤¹¡£\n"
3534 "¥À¥á¡¼¥¸·Ú¸º¤ÏÄ̾ï¤ÎľÀܹ¶·â(¼ïÎब¡Ö¹¶·â¤¹¤ë¡×¤È¡ÖÊ´ºÕ¤¹¤ë¡×¤Îʪ)\n"
3535 "¤ËÂФ·¤Æ¤Î¤ß¸ú²Ì¤¬¤¢¤ê¤Þ¤¹¡£\n \n"
3536 "Ũ¤Î¥ì¥Ù¥ë¤È¤Ï¡¢¤½¤ÎŨ¤¬Ä̾ﲿ³¬¤Ë¸½¤ì¤ë¤«¤ò¼¨¤·¤Þ¤¹¡£\n \n"
3537 "²óÈòΨ¤ÏŨ¤ÎľÀܹ¶·â¤ò²¿¥Ñ¡¼¥»¥ó¥È¤Î³ÎΨ¤ÇÈò¤±¤ë¤«¤ò¼¨¤·¡¢\n"
3538 "Ũ¤Î¥ì¥Ù¥ë¤È¤¢¤Ê¤¿¤ÎAC¤Ë¤è¤Ã¤Æ·èÄꤵ¤ì¤Þ¤¹¡£\n \n"
3539 "¥À¥á¡¼¥¸´üÂÔÃͤȤϡ¢Å¨¤Î£±£°£°¥Ý¥¤¥ó¥È¤ÎÄ̾ﹶ·â¤ËÂФ·¡¢\n"
3540 "²óÈòΨ¤È¥À¥á¡¼¥¸·Ú¸ºÎ¨¤ò¹Íθ¤·¤¿¥À¥á¡¼¥¸¤Î´üÂÔÃͤò¼¨¤·¤Þ¤¹¡£\n";
3543 "'Protection Rate' means how much damage is reduced by your armor.\n"
3544 "Note that the Protection rate is effective only against normal "
3545 "'attack' and 'shatter' type melee attacks, "
3546 "and has no effect against any other types such as 'poison'.\n \n"
3547 "'Dodge Rate' indicates the success rate on dodging the "
3548 "monster's melee attacks. "
3549 "It is depend on the level of the monster and your AC.\n \n"
3550 "'Average Damage' indicates the expected amount of damage "
3551 "when you are attacked by normal melee attacks with power=100.";
3557 char buf[80*20], *t;
3559 /* AC lower than zero has no effect */
3560 if (iAC < 0) iAC = 0;
3562 /* ¥À¥á¡¼¥¸·Ú¸ºÎ¨¤ò·×»» */
3563 protection = 100 * MIN(iAC, 150) / 250;
3569 put_str(format("¤¢¤Ê¤¿¤Î¸½ºß¤ÎAC: %3d", iAC), row++, 0);
3570 put_str(format("¥À¥á¡¼¥¸·Ú¸ºÎ¨ : %3d%%", protection), row++, 0);
3573 put_str("Ũ¤Î¥ì¥Ù¥ë :", row + 0, 0);
3574 put_str("²óÈòΨ :", row + 1, 0);
3575 put_str("¥À¥á¡¼¥¸´üÂÔÃÍ :", row + 2, 0);
3577 put_str(format("Your current AC : %3d", iAC), row++, 0);
3578 put_str(format("Protection rate : %3d%%", protection), row++, 0);
3581 put_str("Level of Monster:", row + 0, 0);
3582 put_str("Dodge Rate :", row + 1, 0);
3583 put_str("Average Damage :", row + 2, 0);
3586 for (col = 17 + 1, lvl = 0; lvl <= 100; lvl += 10, col += 5)
3588 int quality = 60 + lvl * 3; /* attack quality with power 60 */
3589 int dodge; /* ²óÈòΨ(%) */
3590 int average; /* ¥À¥á¡¼¥¸´üÂÔÃÍ */
3592 put_str(format("%3d", lvl), row + 0, col);
3595 dodge = 5 + (MIN(100, 100 * (iAC * 3 / 4) / quality) * 9 + 5) / 10;
3596 put_str(format("%3d%%", dodge), row + 1, col);
3598 /* 100ÅÀ¤Î¹¶·â¤ËÂФ·¤Æ¤Î¥À¥á¡¼¥¸´üÂÔÃͤò·×»» */
3599 average = (100 - dodge) * (100 - protection) / 100;
3600 put_str(format("%3d", average), row + 2, col);
3604 roff_to_buf(memo, 70, buf, sizeof(buf));
3605 for (t = buf; t[0]; t += strlen(t) + 1)
3606 put_str(t, (row++) + 4, 4);
3609 prt("¸½ºß¤Î¤¢¤Ê¤¿¤ÎÁõÈ÷¤«¤é¤¹¤ë¤È¡¢¤¢¤Ê¤¿¤ÎËɸæÎϤÏ"
3610 "¤³¤ì¤¯¤é¤¤¤Ç¤¹:", 0, 0);
3612 prt("Defense abilities from your current Armor Class are evaluated below.", 0, 0);
3627 static bool enchant_item(int cost, int to_hit, int to_dam, int to_ac)
3633 int maxenchant = (p_ptr->lev / 5);
3634 char tmp_str[MAX_NLEN];
3639 prt(format("¸½ºß¤Î¤¢¤Ê¤¿¤Îµ»Î̤À¤È¡¢+%d ¤Þ¤Ç²þÎɤǤ¤Þ¤¹¡£", maxenchant), 5, 0);
3640 prt(format(" ²þÎɤÎÎÁ¶â¤Ï°ì¸Ä¤Ë¤Ä¤¡ð%d ¤Ç¤¹¡£", cost), 7, 0);
3642 prt(format(" Based on your skill, we can improve up to +%d.", maxenchant), 5, 0);
3643 prt(format(" The price for the service is %d gold per item.", cost), 7, 0);
3646 item_tester_no_ryoute = TRUE;
3650 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò²þÎɤ·¤Þ¤¹¤«¡©";
3651 s = "²þÎɤǤ¤ë¤â¤Î¤¬¤¢¤ê¤Þ¤»¤ó¡£";
3653 q = "Improve which item? ";
3654 s = "You have nothing to improve.";
3657 if (!get_item(&item, q, s, (USE_INVEN | USE_EQUIP))) return (FALSE);
3659 /* Get the item (in the pack) */
3660 o_ptr = &inventory[item];
3662 /* Check if the player has enough money */
3663 if (p_ptr->au < (cost * o_ptr->number))
3665 object_desc(tmp_str, o_ptr, TRUE, 0);
3667 msg_format("%s¤ò²þÎɤ¹¤ë¤À¤±¤Î¥´¡¼¥ë¥É¤¬¤¢¤ê¤Þ¤»¤ó¡ª", tmp_str);
3669 msg_format("You do not have the gold to improve %s!", tmp_str);
3675 /* Enchant to hit */
3676 for (i = 0; i < to_hit; i++)
3678 if (o_ptr->to_h < maxenchant)
3680 if (enchant(o_ptr, 1, (ENCH_TOHIT | ENCH_FORCE)))
3688 /* Enchant to damage */
3689 for (i = 0; i < to_dam; i++)
3691 if (o_ptr->to_d < maxenchant)
3693 if (enchant(o_ptr, 1, (ENCH_TODAM | ENCH_FORCE)))
3702 for (i = 0; i < to_ac; i++)
3704 if (o_ptr->to_a < maxenchant)
3706 if (enchant(o_ptr, 1, (ENCH_TOAC | ENCH_FORCE)))
3718 if (flush_failure) flush();
3722 msg_print("²þÎɤ˼ºÇÔ¤·¤¿¡£");
3724 msg_print("The improvement failed.");
3732 object_desc(tmp_str, o_ptr, TRUE, 1);
3734 msg_format("¡ð%d ¤Ç%s¤ò²þÎɤ·¤Þ¤·¤¿¡£", cost * o_ptr->number, tmp_str );
3736 msg_format("Improved %s for %d gold.", tmp_str, cost * o_ptr->number);
3739 /* Charge the money */
3740 p_ptr->au -= (cost * o_ptr->number);
3742 if (item >= INVEN_RARM) calc_android_exp();
3744 /* Something happened */
3751 * Recharge rods, wands and staves
3753 * The player can select the number of charges to add
3754 * (up to a limit), and the recharge never fails.
3756 * The cost for rods depends on the level of the rod. The prices
3757 * for recharging wands and staves are dependent on the cost of
3760 static void building_recharge(void)
3769 char tmp_str[MAX_NLEN];
3773 /* Display some info */
3776 prt(" ºÆ½¼Å¶¤ÎÈñÍѤϥ¢¥¤¥Æ¥à¤Î¼ïÎà¤Ë¤è¤ê¤Þ¤¹¡£", 6, 0);
3778 prt(" The prices of recharge depend on the type.", 6, 0);
3782 /* Only accept legal items */
3783 item_tester_hook = item_tester_hook_recharge;
3787 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ËËâÎϤò½¼Å¶¤·¤Þ¤¹¤«? ";
3788 s = "ËâÎϤò½¼Å¶¤¹¤Ù¤¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡£";
3790 q = "Recharge which item? ";
3791 s = "You have nothing to recharge.";
3794 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
3796 /* Get the item (in the pack) */
3799 o_ptr = &inventory[item];
3802 /* Get the item (on the floor) */
3805 o_ptr = &o_list[0 - item];
3808 k_ptr = &k_info[o_ptr->k_idx];
3811 * We don't want to give the player free info about
3812 * the level of the item or the number of charges.
3814 /* The item must be "known" */
3815 if (!object_known_p(o_ptr))
3818 msg_format("½¼Å¶¤¹¤ëÁ°¤Ë´ÕÄꤵ¤ì¤Æ¤¤¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡ª");
3820 msg_format("The item must be identified first!");
3825 if ((p_ptr->au >= 50) &&
3827 get_check("¡ð50¤Ç´ÕÄꤷ¤Þ¤¹¤«¡© "))
3829 get_check("Identify for 50 gold? "))
3837 identify_item(o_ptr);
3840 object_desc(tmp_str, o_ptr, TRUE, 3);
3843 msg_format("%s ¤Ç¤¹¡£", tmp_str);
3845 msg_format("You have: %s.", tmp_str);
3848 /* Auto-inscription */
3849 auto_inscribe_item(item, is_autopick(o_ptr));
3851 /* Update the gold display */
3852 building_prt_gold();
3860 /* Extract the object "level" */
3861 lev = get_object_level(o_ptr);
3863 /* Price for a rod */
3864 if (o_ptr->tval == TV_ROD)
3866 if (o_ptr->timeout > 0)
3868 /* Fully recharge */
3869 price = (lev * 50 * o_ptr->timeout) / k_ptr->pval;
3873 /* No recharge necessary */
3876 msg_format("¤½¤ì¤ÏºÆ½¼Å¶¤¹¤ëɬÍפϤ¢¤ê¤Þ¤»¤ó¡£");
3878 msg_format("That doesn't need to be recharged.");
3884 else if (o_ptr->tval == TV_STAFF)
3886 /* Price per charge ( = double the price paid by shopkeepers for the charge) */
3887 price = (get_object_cost(o_ptr) / 10) * o_ptr->number;
3889 /* Pay at least 10 gold per charge */
3890 price = MAX(10, price);
3894 /* Price per charge ( = double the price paid by shopkeepers for the charge) */
3895 price = (get_object_cost(o_ptr) / 10);
3897 /* Pay at least 10 gold per charge */
3898 price = MAX(10, price);
3901 /* Limit the number of charges for wands and staffs */
3902 if (o_ptr->tval == TV_WAND
3903 && (o_ptr->pval / o_ptr->number >= k_ptr->pval))
3905 if (o_ptr->number > 1)
3908 msg_print("¤³¤ÎËâË¡ËÀ¤Ï¤â¤¦½¼Ê¬¤Ë½¼Å¶¤µ¤ì¤Æ¤¤¤Þ¤¹¡£");
3910 msg_print("These wands are already fully charged.");
3916 msg_print("¤³¤ÎËâË¡ËÀ¤Ï¤â¤¦½¼Ê¬¤Ë½¼Å¶¤µ¤ì¤Æ¤¤¤Þ¤¹¡£");
3918 msg_print("This wand is already fully charged.");
3923 else if (o_ptr->tval == TV_STAFF && o_ptr->pval >= k_ptr->pval)
3925 if (o_ptr->number > 1)
3928 msg_print("¤³¤Î¾ó¤Ï¤â¤¦½¼Ê¬¤Ë½¼Å¶¤µ¤ì¤Æ¤¤¤Þ¤¹¡£");
3930 msg_print("These staffs are already fully charged.");
3936 msg_print("¤³¤Î¾ó¤Ï¤â¤¦½¼Ê¬¤Ë½¼Å¶¤µ¤ì¤Æ¤¤¤Þ¤¹¡£");
3938 msg_print("This staff is already fully charged.");
3944 /* Check if the player has enough money */
3945 if (p_ptr->au < price)
3947 object_desc(tmp_str, o_ptr, TRUE, 0);
3949 msg_format("%s¤òºÆ½¼Å¶¤¹¤ë¤Ë¤Ï¡ð%d ɬÍפǤ¹¡ª", tmp_str,price );
3951 msg_format("You need %d gold to recharge %s!", price, tmp_str);
3957 if (o_ptr->tval == TV_ROD)
3960 if (get_check(format("¤½¤Î¥í¥Ã¥É¤ò¡ð%d ¤ÇºÆ½¼Å¶¤·¤Þ¤¹¤«¡©",
3963 if (get_check(format("Recharge the %s for %d gold? ",
3964 ((o_ptr->number > 1) ? "rods" : "rod"), price)))
3968 /* Recharge fully */
3978 if (o_ptr->tval == TV_STAFF)
3979 max_charges = k_ptr->pval - o_ptr->pval;
3981 max_charges = o_ptr->number * k_ptr->pval - o_ptr->pval;
3983 /* Get the quantity for staves and wands */
3985 charges = get_quantity(format("°ì²óʬ¡ð%d ¤Ç²¿²óʬ½¼Å¶¤·¤Þ¤¹¤«¡©",
3987 charges = get_quantity(format("Add how many charges for %d gold? ",
3990 price), MIN(p_ptr->au / price, max_charges));
3993 if (charges < 1) return;
3995 /* Get the new price */
3999 o_ptr->pval += charges;
4001 /* We no longer think the item is empty */
4002 o_ptr->ident &= ~(IDENT_EMPTY);
4006 object_desc(tmp_str, o_ptr, TRUE, 3);
4008 msg_format("%s¤ò¡ð%d ¤ÇºÆ½¼Å¶¤·¤Þ¤·¤¿¡£", tmp_str, price);
4010 msg_format("%^s %s recharged for %d gold.", tmp_str, ((o_ptr->number > 1) ? "were" : "was"), price);
4013 /* Combine / Reorder the pack (later) */
4014 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
4017 p_ptr->window |= (PW_INVEN);
4028 * Recharge rods, wands and staves
4030 * The player can select the number of charges to add
4031 * (up to a limit), and the recharge never fails.
4033 * The cost for rods depends on the level of the rod. The prices
4034 * for recharging wands and staves are dependent on the cost of
4037 static void building_recharge_all(void)
4047 /* Display some info */
4051 prt(" ºÆ½¼Å¶¤ÎÈñÍѤϥ¢¥¤¥Æ¥à¤Î¼ïÎà¤Ë¤è¤ê¤Þ¤¹¡£", 6, 0);
4053 prt(" The prices of recharge depend on the type.", 6, 0);
4056 /* Calculate cost */
4057 for ( i = 0; i < INVEN_PACK; i++)
4059 o_ptr = &inventory[i];
4061 /* skip non magic device */
4062 if (o_ptr->tval < TV_STAFF || o_ptr->tval > TV_ROD) continue;
4064 /* need identified */
4065 if (!object_known_p(o_ptr)) total_cost += 50;
4067 /* Extract the object "level" */
4068 lev = get_object_level(o_ptr);
4070 k_ptr = &k_info[o_ptr->k_idx];
4072 switch (o_ptr->tval)
4075 price = (lev * 50 * o_ptr->timeout) / k_ptr->pval;
4079 /* Price per charge ( = double the price paid by shopkeepers for the charge) */
4080 price = (get_object_cost(o_ptr) / 10) * o_ptr->number;
4082 /* Pay at least 10 gold per charge */
4083 price = MAX(10, price);
4086 price = (k_ptr->pval - o_ptr->pval) * price;
4090 /* Price per charge ( = double the price paid by shopkeepers for the charge) */
4091 price = (get_object_cost(o_ptr) / 10);
4093 /* Pay at least 10 gold per charge */
4094 price = MAX(10, price);
4097 price = (o_ptr->number * k_ptr->pval - o_ptr->pval) * price;
4101 /* if price <= 0 then item have enough charge */
4102 if (price > 0) total_cost += price;
4108 msg_print("½¼Å¶¤¹¤ëɬÍפϤ¢¤ê¤Þ¤»¤ó¡£");
4110 msg_print("No need to recharge.");
4117 /* Check if the player has enough money */
4118 if (p_ptr->au < total_cost)
4121 msg_format("¤¹¤Ù¤Æ¤Î¥¢¥¤¥Æ¥à¤òºÆ½¼Å¶¤¹¤ë¤Ë¤Ï¡ð%d ɬÍפǤ¹¡ª", total_cost );
4123 msg_format("You need %d gold to recharge all items!",total_cost);
4131 if (!get_check(format("¤¹¤Ù¤Æ¤Î¥¢¥¤¥Æ¥à¤ò ¡ð%d ¤ÇºÆ½¼Å¶¤·¤Þ¤¹¤«¡©", total_cost))) return;
4133 if (!get_check(format("Recharge all items for %d gold? ", total_cost))) return;
4136 for (i = 0; i < INVEN_PACK; i++)
4138 o_ptr = &inventory[i];
4139 k_ptr = &k_info[o_ptr->k_idx];
4141 /* skip non magic device */
4142 if (o_ptr->tval < TV_STAFF || o_ptr->tval > TV_ROD) continue;
4145 if (!object_known_p(o_ptr))
4147 identify_item(o_ptr);
4149 /* Auto-inscription */
4150 auto_inscribe_item(i, is_autopick(o_ptr));
4154 switch (o_ptr->tval)
4160 if (o_ptr->pval < k_ptr->pval) o_ptr->pval = k_ptr->pval;
4161 /* We no longer think the item is empty */
4162 o_ptr->ident &= ~(IDENT_EMPTY);
4165 if (o_ptr->pval < o_ptr->number * k_ptr->pval)
4166 o_ptr->pval = o_ptr->number * k_ptr->pval;
4167 /* We no longer think the item is empty */
4168 o_ptr->ident &= ~(IDENT_EMPTY);
4175 msg_format("¡ð%d ¤ÇºÆ½¼Å¶¤·¤Þ¤·¤¿¡£", total_cost);
4177 msg_format("You pay %d gold.", total_cost);
4182 /* Combine / Reorder the pack (later) */
4183 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
4186 p_ptr->window |= (PW_INVEN);
4189 p_ptr->au -= total_cost;
4196 bool tele_town(void)
4204 msg_print("¤³¤ÎËâË¡¤ÏÃϾå¤Ç¤·¤«»È¤¨¤Ê¤¤¡ª");
4206 msg_print("This spell can only be used on the surface!");
4211 if (p_ptr->inside_arena || p_ptr->inside_battle)
4214 msg_print("¤³¤ÎËâË¡¤Ï³°¤Ç¤·¤«»È¤¨¤Ê¤¤¡ª");
4216 msg_print("This spell can only be used outside!");
4224 for (i=1;i<max_towns;i++)
4228 if ((i == NO_TOWN) || (i == SECRET_TOWN) || (i == p_ptr->town_num) || !(p_ptr->visit & (1L << (i-1)))) continue;
4230 sprintf(buf,"%c) %-20s", I2A(i-1), town[i].name);
4238 msg_print("¤Þ¤À¹Ô¤±¤ë¤È¤³¤í¤¬¤Ê¤¤¡£");
4240 msg_print("You have not yet visited any town.");
4249 prt("¤É¤³¤Ë¹Ô¤¤Þ¤¹¤«:", 0, 0);
4251 prt("Which town you go: ", 0, 0);
4262 else if ((i < 'a') || (i > ('a'+max_towns-2))) continue;
4263 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;
4267 for (y = 0; y < max_wild_y; y++)
4269 for (x = 0; x < max_wild_x; x++)
4271 if(wilderness[y][x].town == (i-'a'+1))
4273 p_ptr->wilderness_y = y;
4274 p_ptr->wilderness_x = x;
4278 p_ptr->leftbldg = TRUE;
4279 p_ptr->leaving = TRUE;
4281 p_ptr->teleport_town = TRUE;
4291 static bool research_mon(void)
4299 bool recall = FALSE;
4305 /* XTRA HACK WHATSEARCH */
4311 /* XTRA HACK REMEMBER_IDX */
4312 static int old_sym = '\0';
4313 static int old_i = 0;
4316 /* Save the screen */
4319 /* Get a character, or abort */
4321 if (!get_com("¥â¥ó¥¹¥¿¡¼¤Îʸ»ú¤òÆþÎϤ·¤Æ²¼¤µ¤¤(µ¹æ or ^AÁ´,^U¥æ,^NÈó¥æ,^M̾Á°):", &sym, FALSE))
4323 if (!get_com("Enter character to be identified(^A:All,^U:Uniqs,^N:Non uniqs,^M:Name): ", &sym, FALSE))
4333 /* Find that character info, and describe it */
4334 for (i = 0; ident_info[i]; ++i)
4336 if (sym == ident_info[i][0]) break;
4339 /* XTRA HACK WHATSEARCH */
4340 if (sym == KTRL('A'))
4344 strcpy(buf, "Á´¥â¥ó¥¹¥¿¡¼¤Î¥ê¥¹¥È");
4346 strcpy(buf, "Full monster list.");
4349 else if (sym == KTRL('U'))
4353 strcpy(buf, "¥æ¥Ë¡¼¥¯¡¦¥â¥ó¥¹¥¿¡¼¤Î¥ê¥¹¥È");
4355 strcpy(buf, "Unique monster list.");
4358 else if (sym == KTRL('N'))
4362 strcpy(buf, "¥æ¥Ë¡¼¥¯³°¥â¥ó¥¹¥¿¡¼¤Î¥ê¥¹¥È");
4364 strcpy(buf, "Non-unique monster list.");
4367 else if (sym == KTRL('M'))
4371 if (!get_string("̾Á°(±Ñ¸ì¤Î¾ì¹ç¾®Ê¸»ú¤Ç²Ä)",temp, 70))
4373 if (!get_string("Enter name:",temp, 70))
4384 sprintf(buf, "̾Á°:%s¤Ë¥Þ¥Ã¥Á",temp);
4386 sprintf(buf, "Monsters with a name \"%s\"",temp);
4389 else if (ident_info[i])
4391 sprintf(buf, "%c - %s.", sym, ident_info[i] + 2);
4396 sprintf(buf, "%c - %s", sym, "̵¸ú¤Êʸ»ú");
4398 sprintf(buf, "%c - %s.", sym, "Unknown Symbol");
4403 /* Display the result */
4407 /* Allocate the "who" array */
4408 C_MAKE(who, max_r_idx, u16b);
4410 /* Collect matching monsters */
4411 for (n = 0, i = 1; i < max_r_idx; i++)
4413 monster_race *r_ptr = &r_info[i];
4416 if (!r_ptr->name) continue;
4418 /* XTRA HACK WHATSEARCH */
4419 /* Require non-unique monsters if needed */
4420 if (norm && (r_ptr->flags1 & (RF1_UNIQUE))) continue;
4422 /* Require unique monsters if needed */
4423 if (uniq && !(r_ptr->flags1 & (RF1_UNIQUE))) continue;
4431 for (xx = 0; temp[xx] && xx < 80; xx++)
4434 if (iskanji(temp[xx]))
4440 if (isupper(temp[xx])) temp[xx] = tolower(temp[xx]);
4444 strcpy(temp2, r_name + r_ptr->E_name);
4446 strcpy(temp2, r_name + r_ptr->name);
4448 for (xx = 0; temp2[xx] && xx < 80; xx++)
4449 if (isupper(temp2[xx])) temp2[xx] = tolower(temp2[xx]);
4452 if (strstr(temp2, temp) || strstr_j(r_name + r_ptr->name, temp))
4454 if (strstr(temp2, temp))
4458 else if (all || (r_ptr->d_char == sym)) who[n++] = i;
4461 /* Nothing to recall */
4464 /* Free the "who" array */
4465 C_KILL(who, max_r_idx, u16b);
4477 /* Sort if needed */
4480 /* Select the sort method */
4481 ang_sort_comp = ang_sort_comp_hook;
4482 ang_sort_swap = ang_sort_swap_hook;
4484 /* Sort the array */
4485 ang_sort(who, &why, n);
4489 /* Start at the end */
4490 /* XTRA HACK REMEMBER_IDX */
4491 if (old_sym == sym && old_i < n) i = old_i;
4496 /* Scan the monster memory */
4499 /* Extract a race */
4502 /* Hack -- Begin the prompt */
4505 /* Hack -- Complete the prompt */
4507 Term_addstr(-1, TERM_WHITE, " ['r'»×¤¤½Ð, ' '¤Ç³¹Ô, ESC]");
4509 Term_addstr(-1, TERM_WHITE, " [(r)ecall, ESC, space to continue]");
4519 /*** Recall on screen ***/
4521 /* Get maximal info about this monster */
4522 lore_do_probe(r_idx);
4524 /* Save this monster ID */
4525 monster_race_track(r_idx);
4527 /* Hack -- Handle stuff */
4530 /* know every thing mode */
4531 screen_roff(r_idx, 0x01);
4534 /* XTRA HACK REMEMBER_IDX */
4542 /* Normal commands */
4543 if (query != 'r') break;
4550 if (query == ESCAPE) break;
4552 /* Move to "prev" monster */
4558 if (!expand_list) break;
4562 /* Move to "next" monster */
4568 if (!expand_list) break;
4574 /* Re-display the identity */
4575 /* prt(buf, 5, 5);*/
4577 /* Free the "who" array */
4578 C_KILL(who, max_r_idx, u16b);
4583 return (!notpicked);
4588 * Execute a building command
4590 static void bldg_process_command(building_type *bldg, int i)
4592 int bact = bldg->actions[i];
4597 /* Flush messages XXX XXX XXX */
4602 bcost = bldg->member_costs[i];
4604 bcost = bldg->other_costs[i];
4606 /* action restrictions */
4607 if (((bldg->action_restr[i] == 1) && !is_member(bldg)) ||
4608 ((bldg->action_restr[i] == 2) && !is_owner(bldg)))
4611 msg_print("¤½¤ì¤òÁªÂò¤¹¤ë¸¢Íø¤Ï¤¢¤ê¤Þ¤»¤ó¡ª");
4613 msg_print("You have no right to choose that!");
4618 /* check gold (HACK - Recharge uses variable costs) */
4619 if ((bact != BACT_RECHARGE) &&
4620 (((bldg->member_costs[i] > p_ptr->au) && is_owner(bldg)) ||
4621 ((bldg->other_costs[i] > p_ptr->au) && !is_owner(bldg))))
4624 msg_print("¤ª¶â¤¬Â¤ê¤Þ¤»¤ó¡ª");
4626 msg_print("You do not have the gold!");
4636 case BACT_RESEARCH_ITEM:
4637 paid = identify_fully(FALSE);
4639 case BACT_TOWN_HISTORY:
4642 case BACT_RACE_LEGENDS:
4648 case BACT_KING_LEGENDS:
4649 case BACT_ARENA_LEGENDS:
4654 case BACT_ARENA_RULES:
4658 case BACT_IN_BETWEEN:
4660 case BACT_SPIN_WHEEL:
4661 case BACT_DICE_SLOTS:
4662 case BACT_GAMBLE_RULES:
4669 paid = inn_comm(bact);
4671 case BACT_RESEARCH_MONSTER:
4672 paid = research_mon();
4674 case BACT_COMPARE_WEAPONS:
4675 paid = compare_weapons();
4677 case BACT_ENCHANT_WEAPON:
4678 item_tester_hook = item_tester_hook_melee_weapon;
4679 enchant_item(bcost, 1, 1, 0);
4681 case BACT_ENCHANT_ARMOR:
4682 item_tester_hook = item_tester_hook_armour;
4683 enchant_item(bcost, 0, 0, 1);
4686 building_recharge();
4688 case BACT_RECHARGE_ALL:
4689 building_recharge_all();
4691 case BACT_IDENTS: /* needs work */
4693 if (!get_check("»ý¤Áʪ¤òÁ´¤Æ´ÕÄꤷ¤Æ¤è¤í¤·¤¤¤Ç¤¹¤«¡©")) break;
4695 msg_print(" »ý¤ÁʪÁ´¤Æ¤¬´ÕÄꤵ¤ì¤Þ¤·¤¿¡£");
4697 if (!get_check("Do you pay for identify all your possession? ")) break;
4699 msg_print("Your possessions have been identified.");
4704 case BACT_IDENT_ONE: /* needs work */
4705 paid = ident_spell(FALSE);
4710 case BACT_HEALING: /* needs work */
4719 case BACT_RESTORE: /* needs work */
4720 if (do_res_stat(A_STR)) paid = TRUE;
4721 if (do_res_stat(A_INT)) paid = TRUE;
4722 if (do_res_stat(A_WIS)) paid = TRUE;
4723 if (do_res_stat(A_DEX)) paid = TRUE;
4724 if (do_res_stat(A_CON)) paid = TRUE;
4725 if (do_res_stat(A_CHR)) paid = TRUE;
4727 case BACT_GOLD: /* set timed reward flag */
4728 if (!p_ptr->rewards[BACT_GOLD])
4731 p_ptr->rewards[BACT_GOLD] = TRUE;
4736 msg_print("º£Æü¤Îʬ¤±Á°¤Ï¤¹¤Ç¤Ë»Ùʧ¤Ã¤¿¤¾¡ª");
4738 msg_print("You just had your daily allowance!");
4742 case BACT_ENCHANT_ARROWS:
4743 item_tester_hook = item_tester_hook_ammo;
4744 enchant_item(bcost, 1, 1, 0);
4746 case BACT_ENCHANT_BOW:
4747 item_tester_tval = TV_BOW;
4748 enchant_item(bcost, 1, 1, 0);
4751 if (recall_player(1)) paid = TRUE;
4753 case BACT_TELEPORT_LEVEL:
4760 select_dungeon = choose_dungeon("¤Ë¥Æ¥ì¥Ý¡¼¥È", 4, 0);
4762 select_dungeon = choose_dungeon("teleport", 4, 0);
4764 show_building(bldg);
4765 if (!select_dungeon) return;
4767 max_depth = d_info[select_dungeon].maxdepth;
4769 /* Limit depth in Angband */
4770 if (select_dungeon == DUNGEON_ANGBAND)
4772 if (quest[QUEST_OBERON].status != QUEST_STATUS_FINISHED) max_depth = 98;
4773 else if(quest[QUEST_SERPENT].status != QUEST_STATUS_FINISHED) max_depth = 99;
4777 amt = get_quantity(format("%s¤Î²¿³¬¤Ë¥Æ¥ì¥Ý¡¼¥È¤·¤Þ¤¹¤«¡©", d_name + d_info[select_dungeon].name), max_depth);
4779 amt = get_quantity(format("Teleport to which level of %s? ", d_name + d_info[select_dungeon].name), max_depth);
4784 p_ptr->word_recall = 1;
4785 p_ptr->recall_dungeon = select_dungeon;
4786 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));
4787 if (record_maxdeapth)
4789 do_cmd_write_nikki(NIKKI_TRUMP, select_dungeon, "¥È¥é¥ó¥×¥¿¥ï¡¼¤Ç");
4791 do_cmd_write_nikki(NIKKI_TRUMP, select_dungeon, "at Trump Tower");
4794 msg_print("²ó¤ê¤ÎÂ絤¤¬Ä¥¤ê¤Ä¤á¤Æ¤¤¿...");
4796 msg_print("The air about you becomes charged...");
4800 p_ptr->redraw |= (PR_STATUS);
4804 case BACT_LOSE_MUTATION:
4805 if (p_ptr->muta1 || p_ptr->muta2 || p_ptr->muta3)
4807 while(!lose_mutation(0));
4813 msg_print("¼£¤¹¤Ù¤ÆÍÁ³ÊÑ°Û¤¬Ìµ¤¤¡£");
4815 msg_print("You have no mutations.");
4823 case BACT_TSUCHINOKO:
4837 msg_print("Ê¿¹Õ²½¤Îµ·¼°¤ò¹Ô¤Ê¤Ã¤¿¡£");
4839 msg_print("You received an equalization ritual.");
4841 set_virtue(V_COMPASSION, 0);
4842 set_virtue(V_HONOUR, 0);
4843 set_virtue(V_JUSTICE, 0);
4844 set_virtue(V_SACRIFICE, 0);
4845 set_virtue(V_KNOWLEDGE, 0);
4846 set_virtue(V_FAITH, 0);
4847 set_virtue(V_ENLIGHTEN, 0);
4848 set_virtue(V_ENCHANT, 0);
4849 set_virtue(V_CHANCE, 0);
4850 set_virtue(V_NATURE, 0);
4851 set_virtue(V_HARMONY, 0);
4852 set_virtue(V_VITALITY, 0);
4853 set_virtue(V_UNLIFE, 0);
4854 set_virtue(V_PATIENCE, 0);
4855 set_virtue(V_TEMPERANCE, 0);
4856 set_virtue(V_DILIGENCE, 0);
4857 set_virtue(V_VALOUR, 0);
4858 set_virtue(V_INDIVIDUALISM, 0);
4862 case BACT_TELE_TOWN:
4866 paid = eval_ac(p_ptr->dis_ac + p_ptr->dis_to_a);
4880 void do_cmd_quest(void)
4884 if (cave[py][px].feat != FEAT_QUEST_ENTER)
4887 msg_print("¤³¤³¤Ë¤Ï¥¯¥¨¥¹¥È¤ÎÆþ¸ý¤Ï¤Ê¤¤¡£");
4889 msg_print("You see no quest level here.");
4897 msg_print("¤³¤³¤Ë¤Ï¥¯¥¨¥¹¥È¤Ø¤ÎÆþ¸ý¤¬¤¢¤ê¤Þ¤¹¡£");
4898 if (!get_check("¥¯¥¨¥¹¥È¤ËÆþ¤ê¤Þ¤¹¤«¡©")) return;
4899 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
4900 msg_print("¡Ø¤È¤Ë¤«¤¯Æþ¤Ã¤Æ¤ß¤è¤¦¤¼¤§¡£¡Ù");
4902 msg_print("There is an entry of a quest.");
4903 if (!get_check("Do you enter? ")) return;
4906 /* Player enters a new quest */
4910 leave_quest_check();
4912 p_ptr->inside_quest = cave[py][px].special;
4913 if(quest[leaving_quest].type != QUEST_TYPE_RANDOM) dun_level = 1;
4914 p_ptr->leftbldg = TRUE;
4915 p_ptr->leaving = TRUE;
4921 * Do building commands
4923 void do_cmd_bldg(void)
4928 building_type *bldg;
4933 if (!((cave[py][px].feat >= FEAT_BLDG_HEAD) &&
4934 (cave[py][px].feat <= FEAT_BLDG_TAIL)))
4937 msg_print("¤³¤³¤Ë¤Ï·úʪ¤Ï¤Ê¤¤¡£");
4939 msg_print("You see no building here.");
4945 which = (cave[py][px].feat - FEAT_BLDG_HEAD);
4947 bldg = &building[which];
4949 /* Don't re-init the wilderness */
4950 reinit_wilderness = FALSE;
4952 if ((which == 2) && (p_ptr->arena_number < 0))
4955 msg_print("¡ÖÇÔ¼Ô¤ËÍѤϤʤ¤¡£¡×");
4957 msg_print("'There's no place here for a LOSER like you!'");
4961 else if ((which == 2) && p_ptr->inside_arena && !p_ptr->exit_bldg)
4964 prt("¥²¡¼¥È¤ÏÊĤޤäƤ¤¤ë¡£¥â¥ó¥¹¥¿¡¼¤¬¤¢¤Ê¤¿¤òÂԤäƤ¤¤ë¡ª",0,0);
4966 prt("The gates are closed. The monster awaits!", 0, 0);
4971 else if ((which == 2) && p_ptr->inside_arena)
4973 /* Restore the surface floor to preserve pets */
4974 prepare_change_floor_mode(CFM_SAVE_SURFACE | CFM_NO_RETURN);
4976 p_ptr->inside_arena = FALSE;
4977 p_ptr->leaving = TRUE;
4979 /* Re-enter the arena */
4980 command_new = SPECIAL_KEY_BUILDING;
4984 else if (p_ptr->inside_battle)
4986 /* Restore the surface floor to preserve pets */
4987 prepare_change_floor_mode(CFM_SAVE_SURFACE | CFM_NO_RETURN);
4989 p_ptr->leaving = TRUE;
4990 p_ptr->inside_battle = FALSE;
4992 /* Re-enter the monster arena */
4993 command_new = SPECIAL_KEY_BUILDING;
5003 /* Forget the lite */
5006 /* Forget the view */
5009 /* Hack -- Increase "icky" depth */
5016 show_building(bldg);
5024 building_prt_gold();
5028 if (command == ESCAPE)
5031 p_ptr->inside_arena = FALSE;
5032 p_ptr->inside_battle = FALSE;
5036 for (i = 0; i < 8; i++)
5038 if (bldg->letters[i])
5040 if (bldg->letters[i] == command)
5049 bldg_process_command(bldg, i);
5058 /* Flush messages XXX XXX XXX */
5062 /* Reinit wilderness to activate quests ... */
5063 if (reinit_wilderness)
5064 p_ptr->leaving = TRUE;
5066 /* Hack -- Decrease "icky" depth */
5069 /* Clear the screen */
5072 /* Update the visuals */
5073 p_ptr->update |= (PU_VIEW | PU_MONSTERS | PU_BONUS | PU_LITE | PU_MON_LITE);
5075 /* Redraw entire screen */
5076 p_ptr->redraw |= (PR_BASIC | PR_EXTRA | PR_EQUIPPY | PR_MAP);
5079 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
5083 /* Array of places to find an inscription */
5084 static cptr find_quest[] =
5087 "¾²¤Ë¥á¥Ã¥»¡¼¥¸¤¬¹ï¤Þ¤ì¤Æ¤¤¤ë:",
5089 "You find the following inscription in the floor",
5093 "Êɤ˥á¥Ã¥»¡¼¥¸¤¬¹ï¤Þ¤ì¤Æ¤¤¤ë:",
5095 "You see a message inscribed in the wall",
5099 "¥á¥Ã¥»¡¼¥¸¤ò¸«¤Ä¤±¤¿:",
5101 "There is a sign saying",
5105 "²¿¤«¤¬³¬Ãʤξå¤Ë½ñ¤¤¤Æ¤¢¤ë:",
5107 "Something is written on the staircase",
5111 "´¬Êª¤ò¸«¤Ä¤±¤¿¡£¥á¥Ã¥»¡¼¥¸¤¬½ñ¤¤¤Æ¤¢¤ë:",
5113 "You find a scroll with the following message",
5122 void quest_discovery(int q_idx)
5124 quest_type *q_ptr = &quest[q_idx];
5125 monster_race *r_ptr = &r_info[q_ptr->r_idx];
5126 int q_num = q_ptr->max_num;
5129 /* No quest index */
5132 strcpy(name, (r_name + r_ptr->name));
5134 msg_print(find_quest[rand_range(0, 4)]);
5141 /* Hack -- "unique" monsters must be "unique" */
5142 if ((r_ptr->flags1 & RF1_UNIQUE) &&
5143 (0 == r_ptr->max_num))
5146 msg_print("¤³¤Î³¬¤Ï°ÊÁ°¤Ï狼¤Ë¤è¤Ã¤Æ¼é¤é¤ì¤Æ¤¤¤¿¤è¤¦¤À¡Ä¡£");
5148 msg_print("It seems that this level was protected by someone before...");
5150 /* The unique is already dead */
5151 quest[q_idx].status = QUEST_STATUS_FINISHED;
5156 msg_format("Ãí°Õ¤»¤è¡ª¤³¤Î³¬¤Ï%s¤Ë¤è¤Ã¤Æ¼é¤é¤ì¤Æ¤¤¤ë¡ª", name);
5158 msg_format("Beware, this level is protected by %s!", name);
5164 /* Normal monsters */
5166 msg_format("Ãí°Õ¤·¤í¡ª¤³¤Î³¬¤Ï%dÂΤÎ%s¤Ë¤è¤Ã¤Æ¼é¤é¤ì¤Æ¤¤¤ë¡ª", q_num, name);
5169 msg_format("Be warned, this level is guarded by %d %s!", q_num, name);
5177 * Hack -- Check if a level is a "quest" level
5179 int quest_number(int level)
5184 if (p_ptr->inside_quest)
5185 return (p_ptr->inside_quest);
5187 for (i = 0; i < max_quests; i++)
5189 if (quest[i].status != QUEST_STATUS_TAKEN) continue;
5191 if ((quest[i].type == QUEST_TYPE_KILL_LEVEL) &&
5192 !(quest[i].flags & QUEST_FLAG_PRESET) &&
5193 (quest[i].level == level) &&
5194 (quest[i].dungeon == dungeon_type))
5198 /* Check for random quest */
5199 return (random_quest_number(level));
5204 * Return the index of the random quest on this level
5207 int random_quest_number(int level)
5211 if (dungeon_type != DUNGEON_ANGBAND) return 0;
5213 for (i = MIN_RANDOM_QUEST; i < MAX_RANDOM_QUEST + 1; i++)
5215 if ((quest[i].type == QUEST_TYPE_RANDOM) &&
5216 (quest[i].status == QUEST_STATUS_TAKEN) &&
5217 (quest[i].level == level) &&
5218 (quest[i].dungeon == DUNGEON_ANGBAND))