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 /* remember building location */
20 static int building_loc = 0;
22 static bool reinit_wilderness = FALSE;
24 static bool is_owner(building_type *bldg)
26 if (bldg->member_class[p_ptr->pclass] == BUILDING_OWNER)
31 if (bldg->member_race[p_ptr->prace] == BUILDING_OWNER)
36 if ((is_magic(p_ptr->realm1) && (bldg->member_realm[p_ptr->realm1] == BUILDING_OWNER)) ||
37 (is_magic(p_ptr->realm2) && (bldg->member_realm[p_ptr->realm2] == BUILDING_OWNER)))
46 static bool is_member(building_type *bldg)
48 if (bldg->member_class[p_ptr->pclass])
53 if (bldg->member_race[p_ptr->prace])
58 if ((is_magic(p_ptr->realm1) && bldg->member_realm[p_ptr->realm1]) ||
59 (is_magic(p_ptr->realm2) && bldg->member_realm[p_ptr->realm2]))
65 if (p_ptr->pclass == CLASS_SORCERER)
69 for (i = 0; i < MAX_MAGIC; i++)
71 if (bldg->member_realm[i+1]) OK = TRUE;
80 * Clear the building information
82 static void clear_bldg(int min_row, int max_row)
86 for (i = min_row; i <= max_row; i++)
90 static void building_prt_gold(void)
95 prt("¼ê»ý¤Á¤Î¤ª¶â: ", 23,53);
97 prt("Gold Remaining: ", 23, 53);
101 sprintf(tmp_str, "%9ld", (long)p_ptr->au);
102 prt(tmp_str, 23, 68);
107 * Display a building.
109 static void show_building(building_type* bldg)
117 sprintf(tmp_str, "%s (%s) %35s", bldg->owner_name, bldg->owner_race, bldg->name);
121 for (i = 0; i < 8; i++)
123 if (bldg->letters[i])
125 if (bldg->action_restr[i] == 0)
127 if ((is_owner(bldg) && (bldg->member_costs[i] == 0)) ||
128 (!is_owner(bldg) && (bldg->other_costs[i] == 0)))
130 action_color = TERM_WHITE;
133 else if (is_owner(bldg))
135 action_color = TERM_YELLOW;
137 sprintf(buff, "($%ld)", bldg->member_costs[i]);
139 sprintf(buff, "(%ldgp)", bldg->member_costs[i]);
145 action_color = TERM_YELLOW;
147 sprintf(buff, "($%ld)", bldg->other_costs[i]);
149 sprintf(buff, "(%ldgp)", bldg->other_costs[i]);
154 else if (bldg->action_restr[i] == 1)
156 if (!is_member(bldg))
158 action_color = TERM_L_DARK;
160 strcpy(buff, "(ÊÄŹ)");
162 strcpy(buff, "(closed)");
166 else if ((is_owner(bldg) && (bldg->member_costs[i] == 0)) ||
167 (is_member(bldg) && (bldg->other_costs[i] == 0)))
169 action_color = TERM_WHITE;
172 else if (is_owner(bldg))
174 action_color = TERM_YELLOW;
176 sprintf(buff, "($%ld)", bldg->member_costs[i]);
178 sprintf(buff, "(%ldgp)", bldg->member_costs[i]);
184 action_color = TERM_YELLOW;
186 sprintf(buff, "($%ld)", bldg->other_costs[i]);
188 sprintf(buff, "(%ldgp)", bldg->other_costs[i]);
197 action_color = TERM_L_DARK;
199 strcpy(buff, "(ÊÄŹ)");
201 strcpy(buff, "(closed)");
205 else if (bldg->member_costs[i] != 0)
207 action_color = TERM_YELLOW;
209 sprintf(buff, "($%ld)", bldg->member_costs[i]);
211 sprintf(buff, "(%ldgp)", bldg->member_costs[i]);
217 action_color = TERM_WHITE;
222 sprintf(tmp_str," %c) %s %s", bldg->letters[i], bldg->act_names[i], buff);
223 c_put_str(action_color, tmp_str, 19+(i/2), 35*(i%2));
228 prt(" ESC) ·úʪ¤ò½Ð¤ë", 23, 0);
230 prt(" ESC) Exit building", 23, 0);
239 static void arena_comm(int cmd)
248 if (p_ptr->arena_number == MAX_ARENA_MONS)
252 prt("¥¢¥ê¡¼¥Ê¤ÎÍ¥¾¡¼Ô¡ª", 5, 0);
253 prt("¤ª¤á¤Ç¤È¤¦¡ª¤¢¤Ê¤¿¤ÏÁ´¤Æ¤ÎŨ¤òÅݤ·¤Þ¤·¤¿¡£", 7, 0);
254 prt("¾Þ¶â¤È¤·¤Æ $1,000,000 ¤¬Í¿¤¨¤é¤ì¤Þ¤¹¡£", 8, 0);
256 prt(" Arena Victor!", 5, 0);
257 prt("Congratulations! You have defeated all before you.", 7, 0);
258 prt("For that, receive the prize: 1,000,000 gold pieces", 8, 0);
263 p_ptr->au += 1000000L;
265 msg_print("¥¹¥Ú¡¼¥¹¥¡¼¤Ç³¹Ô");
267 msg_print("Press the space bar to continue");
271 p_ptr->arena_number++;
273 else if (p_ptr->arena_number > MAX_ARENA_MONS)
275 if (p_ptr->arena_number < MAX_ARENA_MONS+2)
278 msg_print("·¯¤Î¤¿¤á¤ËºÇ¶¯¤ÎÄ©Àï¼Ô¤òÍÑ°Õ¤·¤Æ¤ª¤¤¤¿¡£");
280 msg_print("The strongest challenger is waiting for you.");
285 if (get_check("Ä©À魯¤ë¤«¤Í¡©"))
287 if (get_check("Do you fight? "))
290 p_ptr->leftbldg = TRUE;
291 p_ptr->inside_arena = TRUE;
292 p_ptr->exit_bldg = FALSE;
294 p_ptr->leaving = TRUE;
300 msg_print("»ÄÇ°¤À¡£");
302 msg_print("We are disappointed.");
309 msg_print("¤¢¤Ê¤¿¤Ï¥¢¥ê¡¼¥Ê¤ËÆþ¤ê¡¢¤·¤Ð¤é¤¯¤Î´Ö±É¸÷¤Ë¤Ò¤¿¤Ã¤¿¡£");
311 msg_print("You enter the arena briefly and bask in your glory.");
317 else if (p_ptr->riding && (p_ptr->pclass != CLASS_BEASTMASTER) && (p_ptr->pclass != CLASS_CAVALRY))
320 msg_print("¥Ú¥Ã¥È¤Ë¾è¤Ã¤¿¤Þ¤Þ¤Ç¤Ï¥¢¥ê¡¼¥Ê¤ØÆþ¤ì¤µ¤»¤Æ¤â¤é¤¨¤Ê¤«¤Ã¤¿¡£");
322 msg_print("You don't have permission to enter with pet.");
329 p_ptr->leftbldg = TRUE;
330 p_ptr->inside_arena = TRUE;
331 p_ptr->exit_bldg = FALSE;
333 p_ptr->leaving = TRUE;
338 if (p_ptr->arena_number == MAX_ARENA_MONS)
340 msg_print("¤¢¤Ê¤¿¤Ï¾¡Íø¼Ô¤À¡£ ¥¢¥ê¡¼¥Ê¤Ç¤Î¥»¥ì¥â¥Ë¡¼¤Ë»²²Ã¤·¤Ê¤µ¤¤¡£");
342 msg_print("You are victorious. Enter the arena for the ceremony.");
345 else if (p_ptr->arena_number > MAX_ARENA_MONS)
348 msg_print("¤¢¤Ê¤¿¤Ï¤¹¤Ù¤Æ¤ÎŨ¤Ë¾¡Íø¤·¤¿¡£");
350 msg_print("You have won against all foes.");
355 r_ptr = &r_info[arena_monsters[p_ptr->arena_number]];
356 name = (r_name + r_ptr->name);
358 msg_format("%s ¤ËÄ©À魯¤ë¤â¤Î¤Ï¤¤¤Ê¤¤¤«¡©", name);
360 msg_format("Do I hear any challenges against: %s", name);
364 case BACT_ARENA_RULES:
369 /* Peruse the arena help file */
371 (void)show_file(TRUE, "arena_j.txt", NULL, 0, 0);
373 (void)show_file(TRUE, "arena.txt", NULL, 0, 0);
386 * display fruit for dice slots
388 static void display_fruit(int row, int col, int fruit)
394 c_put_str(TERM_YELLOW, " ####.", row, col);
395 c_put_str(TERM_YELLOW, " # #", row + 1, col);
396 c_put_str(TERM_YELLOW, " # #", row + 2, col);
397 c_put_str(TERM_YELLOW, "# #", row + 3, col);
398 c_put_str(TERM_YELLOW, "# #", row + 4, col);
399 c_put_str(TERM_YELLOW, "# # ", row + 5, col);
400 c_put_str(TERM_YELLOW, "# # ", row + 6, col);
401 c_put_str(TERM_YELLOW, ".#### ", row + 7, col);
402 prt( " ¥ì¥â¥ó ", row + 8, col);
404 c_put_str(TERM_YELLOW, " ####.", row, col);
405 c_put_str(TERM_YELLOW, " # #", row + 1, col);
406 c_put_str(TERM_YELLOW, " # #", row + 2, col);
407 c_put_str(TERM_YELLOW, "# #", row + 3, col);
408 c_put_str(TERM_YELLOW, "# #", row + 4, col);
409 c_put_str(TERM_YELLOW, "# # ", row + 5, col);
410 c_put_str(TERM_YELLOW, "# # ", row + 6, col);
411 c_put_str(TERM_YELLOW, ".#### ", row + 7, col);
412 prt( " Lemon ", row + 8, col);
418 c_put_str(TERM_ORANGE, " ## ", row, col);
419 c_put_str(TERM_ORANGE, " #..# ", row + 1, col);
420 c_put_str(TERM_ORANGE, " #....# ", row + 2, col);
421 c_put_str(TERM_ORANGE, "#......#", row + 3, col);
422 c_put_str(TERM_ORANGE, "#......#", row + 4, col);
423 c_put_str(TERM_ORANGE, " #....# ", row + 5, col);
424 c_put_str(TERM_ORANGE, " #..# ", row + 6, col);
425 c_put_str(TERM_ORANGE, " ## ", row + 7, col);
426 prt( "¥ª¥ì¥ó¥¸", row + 8, col);
428 c_put_str(TERM_ORANGE, " ## ", row, col);
429 c_put_str(TERM_ORANGE, " #..# ", row + 1, col);
430 c_put_str(TERM_ORANGE, " #....# ", row + 2, col);
431 c_put_str(TERM_ORANGE, "#......#", row + 3, col);
432 c_put_str(TERM_ORANGE, "#......#", row + 4, col);
433 c_put_str(TERM_ORANGE, " #....# ", row + 5, col);
434 c_put_str(TERM_ORANGE, " #..# ", row + 6, col);
435 c_put_str(TERM_ORANGE, " ## ", row + 7, col);
436 prt( " Orange ", row + 8, col);
442 c_put_str(TERM_SLATE, " ¦« " , row, col);
443 c_put_str(TERM_SLATE, " || " , row + 1, col);
444 c_put_str(TERM_SLATE, " || " , row + 2, col);
445 c_put_str(TERM_SLATE, " || " , row + 3, col);
446 c_put_str(TERM_SLATE, " || " , row + 4, col);
447 c_put_str(TERM_SLATE, " || " , row + 5, col);
448 c_put_str(TERM_UMBER, " |=°¡=| " , row + 6, col);
449 c_put_str(TERM_UMBER, " ÌÜ " , row + 7, col);
450 prt( " ·õ " , row + 8, col);
452 c_put_str(TERM_SLATE, " /\\ " , row, col);
453 c_put_str(TERM_SLATE, " ## " , row + 1, col);
454 c_put_str(TERM_SLATE, " ## " , row + 2, col);
455 c_put_str(TERM_SLATE, " ## " , row + 3, col);
456 c_put_str(TERM_SLATE, " ## " , row + 4, col);
457 c_put_str(TERM_SLATE, " ## " , row + 5, col);
458 c_put_str(TERM_UMBER, " ###### " , row + 6, col);
459 c_put_str(TERM_UMBER, " ## " , row + 7, col);
460 prt( " Sword " , row + 8, col);
466 c_put_str(TERM_SLATE, " ###### ", row, col);
467 c_put_str(TERM_SLATE, "# #", row + 1, col);
468 c_put_str(TERM_SLATE, "# ++++ #", row + 2, col);
469 c_put_str(TERM_SLATE, "# +==+ #", row + 3, col);
470 c_put_str(TERM_SLATE, "# ++ #", row + 4, col);
471 c_put_str(TERM_SLATE, " # # ", row + 5, col);
472 c_put_str(TERM_SLATE, " # # ", row + 6, col);
473 c_put_str(TERM_SLATE, " ## ", row + 7, col);
474 prt( " ½â ", row + 8, col);
476 c_put_str(TERM_SLATE, " ###### ", row, col);
477 c_put_str(TERM_SLATE, "# #", row + 1, col);
478 c_put_str(TERM_SLATE, "# ++++ #", row + 2, col);
479 c_put_str(TERM_SLATE, "# +==+ #", row + 3, col);
480 c_put_str(TERM_SLATE, "# ++ #", row + 4, col);
481 c_put_str(TERM_SLATE, " # # ", row + 5, col);
482 c_put_str(TERM_SLATE, " # # ", row + 6, col);
483 c_put_str(TERM_SLATE, " ## ", row + 7, col);
484 prt( " Shield ", row + 8, col);
490 c_put_str(TERM_VIOLET, " ## ", row, col);
491 c_put_str(TERM_VIOLET, " ###### ", row + 1, col);
492 c_put_str(TERM_VIOLET, "########", row + 2, col);
493 c_put_str(TERM_VIOLET, "########", row + 3, col);
494 c_put_str(TERM_VIOLET, "########", row + 4, col);
495 c_put_str(TERM_VIOLET, " ###### ", row + 5, col);
496 c_put_str(TERM_VIOLET, " #### ", row + 6, col);
497 c_put_str(TERM_VIOLET, " ## ", row + 7, col);
498 prt( " ¥×¥é¥à ", row + 8, col);
500 c_put_str(TERM_VIOLET, " ## ", row, col);
501 c_put_str(TERM_VIOLET, " ###### ", row + 1, col);
502 c_put_str(TERM_VIOLET, "########", row + 2, col);
503 c_put_str(TERM_VIOLET, "########", row + 3, col);
504 c_put_str(TERM_VIOLET, "########", row + 4, col);
505 c_put_str(TERM_VIOLET, " ###### ", row + 5, col);
506 c_put_str(TERM_VIOLET, " #### ", row + 6, col);
507 c_put_str(TERM_VIOLET, " ## ", row + 7, col);
508 prt( " Plum ", row + 8, col);
514 c_put_str(TERM_RED, " ##", row, col);
515 c_put_str(TERM_RED, " ### ", row + 1, col);
516 c_put_str(TERM_RED, " #..# ", row + 2, col);
517 c_put_str(TERM_RED, " #..# ", row + 3, col);
518 c_put_str(TERM_RED, " ###### ", row + 4, col);
519 c_put_str(TERM_RED, "#..##..#", row + 5, col);
520 c_put_str(TERM_RED, "#..##..#", row + 6, col);
521 c_put_str(TERM_RED, " ## ## ", row + 7, col);
522 prt( "¥Á¥§¥ê¡¼", row + 8, col);
524 c_put_str(TERM_RED, " ##", row, col);
525 c_put_str(TERM_RED, " ### ", row + 1, col);
526 c_put_str(TERM_RED, " #..# ", row + 2, col);
527 c_put_str(TERM_RED, " #..# ", row + 3, col);
528 c_put_str(TERM_RED, " ###### ", row + 4, col);
529 c_put_str(TERM_RED, "#..##..#", row + 5, col);
530 c_put_str(TERM_RED, "#..##..#", row + 6, col);
531 c_put_str(TERM_RED, " ## ## ", row + 7, col);
532 prt( " Cherry ", row + 8, col);
540 * kpoker no (tyuto-hannpa na)pakuri desu...
541 * joker ha shineru node haitte masen.
543 * TODO: donataka! tsukutte!
544 * - agatta yaku no kiroku (like DQ).
545 * - kakkoii card no e.
546 * - sousa-sei no koujyo.
547 * - code wo wakariyasuku.
549 * - Joker... -- done.
552 * 9/15/2000 joker wo jissou. soreto, code wo sukosi kakikae. --Habu
554 #define SUIT_OF(card) ((card) / 13)
555 #define NUM_OF(card) ((card) % 13)
556 #define IS_JOKER(card) ((card) == 52)
558 static int cards[5]; /* tefuda no card */
560 static void reset_deck(int deck[])
563 for (i = 0; i < 53; i++) deck[i] = i;
566 for (i = 0; i < 53; i++){
567 int tmp1 = randint0(53 - i) + i;
569 deck[i] = deck[tmp1];
574 static bool have_joker()
578 for (i = 0; i < 5; i++){
579 if(IS_JOKER(cards[i])) return TRUE;
584 static bool find_card_num(int num)
587 for (i = 0; i < 5; i++)
588 if (NUM_OF(cards[i]) == num && !IS_JOKER(cards[i])) return TRUE;
592 static bool yaku_check_flush()
595 bool joker_is_used = FALSE;
597 suit = IS_JOKER(cards[0]) ? SUIT_OF(cards[1]) : SUIT_OF(cards[0]);
598 for (i = 0; i < 5; i++){
599 if (SUIT_OF(cards[i]) != suit){
600 if(have_joker() && !joker_is_used)
601 joker_is_used = TRUE;
610 static int yaku_check_straight()
613 bool joker_is_used = FALSE;
616 for (i = 0; i < 5; i++)
618 if (NUM_OF(cards[i]) < lowest && !IS_JOKER(cards[i]))
619 lowest = NUM_OF(cards[i]);
622 if (yaku_check_flush())
625 for (i = 0; i < 4; i++)
627 if (!find_card_num(9 + i)){
628 if( have_joker() && !joker_is_used )
629 joker_is_used = TRUE;
634 if (i == 4) return 3; /* Wow! Royal Flush!!! */
637 for (i = 0; i < 3; i++)
639 if (!find_card_num(10 + i))
642 if (i == 3 && have_joker()) return 3; /* Wow! Royal Flush!!! */
646 joker_is_used = FALSE;
647 for (i = 0; i < 5; i++)
649 if (!find_card_num(lowest + i)){
650 if( have_joker() && !joker_is_used )
651 joker_is_used = TRUE;
657 if (yaku_check_flush())
658 return 2; /* Straight Flush */
664 * 0:nopair 1:1 pair 2:2 pair 3:3 cards 4:full house 6:4cards
666 static int yaku_check_pair()
668 int i, i2, matching = 0;
670 for (i = 0; i < 5; i++)
672 for (i2 = i+1; i2 < 5; i2++)
674 if (IS_JOKER(cards[i]) || IS_JOKER(cards[i2])) continue;
675 if (NUM_OF(cards[i]) == NUM_OF(cards[i2]))
717 static int yaku_check()
721 switch(yaku_check_straight()){
724 c_put_str(TERM_YELLOW, "¥í¥¤¥ä¥ë¥¹¥È¥ì¡¼¥È¥Õ¥é¥Ã¥·¥å", 4, 3);
726 c_put_str(TERM_YELLOW, "Royal Flush", 4, 3);
731 c_put_str(TERM_YELLOW, "¥¹¥È¥ì¡¼¥È¥Õ¥é¥Ã¥·¥å", 4, 3);
733 c_put_str(TERM_YELLOW, "Straight Flush", 4, 3);
738 c_put_str(TERM_YELLOW, "¥¹¥È¥ì¡¼¥È", 4, 3);
740 c_put_str(TERM_YELLOW, "Straight", 4, 3);
744 /* Not straight -- fall through */
748 if (yaku_check_flush())
752 c_put_str(TERM_YELLOW, "¥Õ¥é¥Ã¥·¥å", 4, 3);
754 c_put_str(TERM_YELLOW, "Flush", 4, 3);
759 switch (yaku_check_pair())
763 c_put_str(TERM_YELLOW, "¥ï¥ó¥Ú¥¢", 4, 3);
765 c_put_str(TERM_YELLOW, "One pair", 4, 3);
770 c_put_str(TERM_YELLOW, "¥Ä¡¼¥Ú¥¢", 4, 3);
772 c_put_str(TERM_YELLOW, "Two pair", 4, 3);
777 c_put_str(TERM_YELLOW, "¥¹¥ê¡¼¥«¡¼¥É", 4, 3);
779 c_put_str(TERM_YELLOW, "Three of a kind", 4, 3);
784 c_put_str(TERM_YELLOW, "¥Õ¥ë¥Ï¥¦¥¹", 4, 3);
786 c_put_str(TERM_YELLOW, "Full house", 4, 3);
791 c_put_str(TERM_YELLOW, "¥Õ¥©¡¼¥«¡¼¥É", 4, 3);
793 c_put_str(TERM_YELLOW, "Four of a kind", 4, 3);
797 if (!NUM_OF(cards[0]) || !NUM_OF(cards[1]))
800 c_put_str(TERM_YELLOW, "¥Õ¥¡¥¤¥Ö¥¨¡¼¥¹", 4, 3);
802 c_put_str(TERM_YELLOW, "Five ace", 4, 3);
809 c_put_str(TERM_YELLOW, "¥Õ¥¡¥¤¥Ö¥«¡¼¥É", 4, 3);
811 c_put_str(TERM_YELLOW, "Five of a kind", 4, 3);
821 static void display_kaeruka(int hoge, int kaeruka[])
824 char col = TERM_WHITE;
825 for (i = 0; i < 5; i++)
827 if (i == hoge) col = TERM_YELLOW;
828 else if(kaeruka[i]) col = TERM_WHITE;
829 else col = TERM_L_BLUE;
832 c_put_str(col, "¤«¤¨¤ë", 14, 5+i*16);
834 c_put_str(col, "¤Î¤³¤¹", 14, 5+i*16);
837 c_put_str(col, "Change", 14, 5+i*16);
839 c_put_str(col, " Stay ", 14, 5+i*16);
842 if (hoge > 4) col = TERM_YELLOW;
843 else col = TERM_WHITE;
845 c_put_str(col, "·èÄê", 16, 38);
847 c_put_str(col, "Sure", 16, 38);
850 /* Hilite current option */
851 if (hoge < 5) move_cursor(14, 5+hoge*16);
852 else move_cursor(16, 38);
856 static void display_cards()
859 char suitcolor[4] = {TERM_YELLOW, TERM_L_RED, TERM_L_BLUE, TERM_L_GREEN};
861 cptr suit[4] = {"¡ú", "¡ü", "¢ù", "¢÷"};
862 cptr card_grph[13][7] = {{"£Á %s ",
953 cptr joker_grph[7] = { " ",
963 cptr suit[4] = {"[]", "qp", "<>", "db"};
964 cptr card_grph[13][7] = {{"A %s ",
1055 cptr joker_grph[7] = { " ",
1064 for (i = 0; i < 5; i++)
1067 prt("¨®¨¬¨¬¨¬¨¬¨¬¨¬¨¯", 5, i*16);
1069 prt(" +------------+ ", 5, i*16);
1073 for (i = 0; i < 5; i++)
1075 for (j = 0; j < 7; j++)
1078 prt("¨", j+6, i*16);
1080 prt(" |", j+6, i*16);
1082 if(IS_JOKER(cards[i]))
1083 c_put_str(TERM_VIOLET, joker_grph[j], j+6, 2+i*16);
1085 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);
1087 prt("¨", j+6, i*16+14);
1089 prt("| ", j+6, i*16+14);
1093 for (i = 0; i < 5; i++)
1096 prt("¨±¨¬¨¬¨¬¨¬¨¬¨¬¨°", 13, i*16);
1098 prt(" +------------+ ", 13, i*16);
1103 static int do_poker()
1107 int deck[53]; /* yamafuda : 0...52 */
1109 int kaeruka[5]; /* 0:kaenai 1:kaeru */
1113 bool kakikae = TRUE;
1117 for (i = 0; i < 5; i++)
1119 cards[i] = deck[deck_ptr++];
1120 kaeruka[i] = 0; /* default:nokosu */
1140 /* debug:Four Cards */
1142 cards[1] = 0 + 13 * 1;
1143 cards[2] = 0 + 13 * 2;
1144 cards[3] = 0 + 13 * 3;
1148 /* debug:Straight */
1164 /* suteruno wo kimeru */
1166 prt("»Ä¤¹¥«¡¼¥É¤ò·è¤á¤Æ²¼¤µ¤¤(Êý¸þ¤Ç°ÜÆ°, ¥¹¥Ú¡¼¥¹¤ÇÁªÂò)¡£", 0, 0);
1168 prt("Stay witch? ", 0, 0);
1176 if (kakikae) display_kaeruka(k+kettei*5, kaeruka);
1181 case '6': case 'l': case 'L': case KTRL('F'):
1182 if (!kettei) k = (k+1)%5;
1183 else {k = 0;kettei = FALSE;}
1186 case '4': case 'h': case 'H': case KTRL('B'):
1187 if (!kettei) k = (k+4)%5;
1188 else {k = 4;kettei = FALSE;}
1191 case '2': case 'j': case 'J': case KTRL('N'):
1192 if (!kettei) {kettei = TRUE;kakikae = TRUE;}
1194 case '8': case 'k': case 'K': case KTRL('P'):
1195 if (kettei) {kettei = FALSE;kakikae = TRUE;}
1197 case ' ': case '\r':
1198 if (kettei) done = TRUE;
1199 else {kaeruka[k] = !kaeruka[k];kakikae = TRUE;}
1208 for (i = 0; i < 5; i++)
1209 if (kaeruka[i] == 1) cards[i] = deck[deck_ptr++]; /* soshite toru */
1213 return yaku_check();
1218 /* end of poker codes --Koka */
1223 static bool gamble_comm(int cmd)
1226 int roll1, roll2, roll3, choice, odds, win;
1231 char out_val[160], tmp_str[80], again;
1236 if (cmd == BACT_GAMBLE_RULES)
1238 /* Peruse the gambling help file */
1240 (void)show_file(TRUE, "jgambling.txt", NULL, 0, 0);
1242 (void)show_file(TRUE, "gambling.txt", NULL, 0, 0);
1252 msg_print("¤ª¤¤¡ª¤ª¤Þ¤¨°ìʸ¤Ê¤·¤¸¤ã¤Ê¤¤¤«¡ª¤³¤Ã¤«¤é½Ð¤Æ¤¤¤±¡ª");
1254 msg_print("Hey! You don't have gold - get out of here!");
1264 maxbet = p_ptr->lev * 200;
1266 /* We can't bet more than we have */
1267 maxbet = MIN(maxbet, p_ptr->au);
1270 strcpy(out_val, "");
1272 sprintf(tmp_str,"ÅÒ¤±¶â (1-%ld)¡©", maxbet);
1274 sprintf(tmp_str,"Your wager (1-%ld) ? ", maxbet);
1279 * Use get_string() because we may need more than
1280 * the s16b value returned by get_quantity().
1282 if (get_string(tmp_str, out_val, 32))
1285 for (p = out_val; *p == ' '; p++);
1290 if (wager > p_ptr->au)
1293 msg_print("¤ª¤¤¡ª¶â¤¬Â¤ê¤Ê¤¤¤¸¤ã¤Ê¤¤¤«¡ª½Ð¤Æ¤¤¤±¡ª");
1295 msg_print("Hey! You don't have the gold - get out of here!");
1302 else if (wager > maxbet)
1305 msg_format("%ld¥´¡¼¥ë¥É¤À¤±¼õ¤±¤è¤¦¡£»Ä¤ê¤Ï¼è¤Ã¤È¤¤Ê¡£", maxbet);
1307 msg_format("I'll take %ld gold of that. Keep the rest.", maxbet);
1315 msg_print("£Ï£Ë¡¢£±¥´¡¼¥ë¥É¤«¤é¤Ï¤¸¤á¤è¤¦¡£");
1317 msg_print("Ok, we'll start with 1 gold.");
1326 oldgold = p_ptr->au;
1329 sprintf(tmp_str, "¥²¡¼¥àÁ°¤Î½ê»ý¶â: %9ld", oldgold);
1331 sprintf(tmp_str, "Gold before game: %9ld", oldgold);
1334 prt(tmp_str, 20, 2);
1337 sprintf(tmp_str, "¸½ºß¤Î³Ý¤±¶â: %9ld", wager);
1339 sprintf(tmp_str, "Current Wager: %9ld", wager);
1342 prt(tmp_str, 21, 2);
1344 /* Prevent savefile-scumming of the casino */
1345 /* Rand_quick = TRUE; */
1346 Rand_value = time(NULL);
1350 #ifdef JP /* Prevent random seed cracking of the casino */
1358 case BACT_IN_BETWEEN: /* Game of In-Between */
1360 c_put_str(TERM_GREEN, "¥¤¥ó¡¦¥Ó¥È¥¤¡¼¥ó",5,2);
1362 c_put_str(TERM_GREEN, "In Between", 5, 2);
1367 roll1 = randint1(10);
1368 roll2 = randint1(10);
1369 choice = randint1(10);
1371 sprintf(tmp_str, "¹õ¥À¥¤¥¹: %d ¹õ¥À¥¤¥¹: %d", roll1, roll2);
1373 sprintf(tmp_str, "Black die: %d Black Die: %d", roll1, roll2);
1378 sprintf(tmp_str, "ÀÖ¥À¥¤¥¹: %d", choice);
1380 sprintf(tmp_str, "Red die: %d", choice);
1383 prt(tmp_str, 11, 14);
1384 if (((choice > roll1) && (choice < roll2)) ||
1385 ((choice < roll1) && (choice > roll2)))
1388 case BACT_CRAPS: /* Game of Craps */
1390 c_put_str(TERM_GREEN, "¥¯¥é¥Ã¥×¥¹", 5, 2);
1392 c_put_str(TERM_GREEN, "Craps", 5, 2);
1397 roll1 = randint1(6);
1398 roll2 = randint1(6);
1399 roll3 = roll1 + roll2;
1402 sprintf(tmp_str, "£±¿¶¤ê¤á: %d %d Total: %d", roll1,
1404 sprintf(tmp_str, "First roll: %d %d Total: %d", roll1,
1409 if ((roll3 == 7) || (roll3 == 11))
1411 else if ((roll3 == 2) || (roll3 == 3) || (roll3 == 12))
1417 msg_print("¤Ê¤Ë¤«¥¡¼¤ò²¡¤¹¤È¤â¤¦°ì²ó¿¶¤ê¤Þ¤¹¡£");
1419 msg_print("Hit any key to roll again");
1423 roll1 = randint1(6);
1424 roll2 = randint1(6);
1425 roll3 = roll1 + roll2;
1428 sprintf(tmp_str, "½ÐÌÜ: %d %d ¹ç·×: %d",
1430 sprintf(tmp_str, "Roll result: %d %d Total: %d",
1433 roll1, roll2, roll3);
1435 if (roll3 == choice)
1437 else if (roll3 == 7)
1439 } while ((win != TRUE) && (win != FALSE));
1442 case BACT_SPIN_WHEEL: /* Spin the Wheel Game */
1446 c_put_str(TERM_GREEN, "¥ë¡¼¥ì¥Ã¥È", 5, 2);
1448 c_put_str(TERM_GREEN, "Wheel", 5, 2);
1451 prt("0 1 2 3 4 5 6 7 8 9", 7, 5);
1452 prt("--------------------------------", 8, 3);
1453 strcpy(out_val, "");
1455 get_string("²¿ÈÖ¡© (0-9): ", out_val, 32);
1457 get_string("Pick a number (0-9): ", out_val, 32);
1460 for (p = out_val; isspace(*p); p++);
1465 msg_print("0È֤ˤ·¤È¤¯¤¼¡£");
1467 msg_print("I'll put you down for 0.");
1472 else if (choice > 9)
1475 msg_print("£Ï£Ë¡¢9È֤ˤ·¤È¤¯¤¼¡£");
1477 msg_print("Ok, I'll put you down for 9.");
1483 roll1 = randint0(10);
1485 sprintf(tmp_str, "¥ë¡¼¥ì¥Ã¥È¤Ï²ó¤ê¡¢»ß¤Þ¤Ã¤¿¡£¾¡¼Ô¤Ï %dÈÖ¤À¡£",
1487 sprintf(tmp_str, "The wheel spins to a stop and the winner is %d",
1491 prt(tmp_str, 13, 3);
1493 prt("*", 9, (3 * roll1 + 5));
1494 if (roll1 == choice)
1498 case BACT_DICE_SLOTS: /* The Dice Slots */
1500 c_put_str(TERM_GREEN, "¥À¥¤¥¹¡¦¥¹¥í¥Ã¥È", 5, 2);
1501 c_put_str(TERM_YELLOW, "¥ì¥â¥ó ¥ì¥â¥ó 2", 6, 37);
1502 c_put_str(TERM_YELLOW, "¥ì¥â¥ó ¥ì¥â¥ó ¥ì¥â¥ó 5", 7, 37);
1503 c_put_str(TERM_ORANGE, "¥ª¥ì¥ó¥¸ ¥ª¥ì¥ó¥¸ ¥ª¥ì¥ó¥¸ 10", 8, 37);
1504 c_put_str(TERM_UMBER, "·õ ·õ ·õ 20", 9, 37);
1505 c_put_str(TERM_SLATE, "½â ½â ½â 50", 10, 37);
1506 c_put_str(TERM_VIOLET, "¥×¥é¥à ¥×¥é¥à ¥×¥é¥à 200", 11, 37);
1507 c_put_str(TERM_RED, "¥Á¥§¥ê¡¼ ¥Á¥§¥ê¡¼ ¥Á¥§¥ê¡¼ 1000", 12, 37);
1509 c_put_str(TERM_GREEN, "Dice Slots", 5, 2);
1513 roll1 = randint1(21);
1523 roll2 = randint1(21);
1533 choice = randint1(21);
1543 put_str("/--------------------------\\", 7, 2);
1544 prt("\\--------------------------/", 17, 2);
1545 display_fruit(8, 3, roll1 - 1);
1546 display_fruit(8, 12, roll2 - 1);
1547 display_fruit(8, 21, choice - 1);
1548 if ((roll1 == roll2) && (roll2 == choice))
1567 else if ((roll1 == 1) && (roll2 == 1))
1576 if (odds) win = TRUE;
1583 prt("¤¢¤Ê¤¿¤Î¾¡¤Á", 16, 37);
1585 prt("YOU WON", 16, 37);
1588 p_ptr->au += odds * wager;
1590 sprintf(tmp_str, "ÇÜΨ: %d", odds);
1592 sprintf(tmp_str, "Payoff: %d", odds);
1595 prt(tmp_str, 17, 37);
1600 prt("¤¢¤Ê¤¿¤ÎÉ餱", 16, 37);
1602 prt("You Lost", 16, 37);
1608 sprintf(tmp_str, "¸½ºß¤Î½ê»ý¶â: %9ld", p_ptr->au);
1610 sprintf(tmp_str, "Current Gold: %9ld", p_ptr->au);
1613 prt(tmp_str, 22, 2);
1615 prt("¤â¤¦°ìÅÙ(Y/N)¡©", 18, 37);
1617 prt("Again(Y/N)?", 18, 37);
1620 move_cursor(18, 52);
1625 if (wager > p_ptr->au)
1628 msg_print("¤ª¤¤¡ª¶â¤¬Â¤ê¤Ê¤¤¤¸¤ã¤Ê¤¤¤«¡ª¤³¤³¤«¤é½Ð¤Æ¹Ô¤±¡ª");
1630 msg_print("Hey! You don't have the gold - get out of here!");
1638 } while ((again == 'y') || (again == 'Y'));
1640 /* Switch back to complex RNG */
1644 if (p_ptr->au >= oldgold)
1647 msg_print("¡Öº£²ó¤ÏÌÙ¤±¤¿¤Ê¡ª¤Ç¤â¼¡¤Ï¤³¤Ã¤Á¤¬¾¡¤Ã¤Æ¤ä¤ë¤«¤é¤Ê¡¢ÀäÂФˡª¡×");
1649 msg_print("You came out a winner! We'll win next time, I'm sure.");
1651 chg_virtue(V_CHANCE, 3);
1656 msg_print("¡Ö¶â¤ò¥¹¥Ã¤Æ¤·¤Þ¤Ã¤¿¤Ê¡¢¤ï¤Ï¤Ï¡ª¤¦¤Á¤Ëµ¢¤Ã¤¿Êý¤¬¤¤¤¤¤¼¡£¡×");
1658 msg_print("You lost gold! Haha, better head home.");
1660 chg_virtue(V_CHANCE, -3);
1669 static bool vault_aux_battle(int r_idx)
1674 monster_race *r_ptr = &r_info[r_idx];
1676 /* Decline town monsters */
1677 /* if (!monster_dungeon(r_idx)) return FALSE; */
1679 /* Decline unique monsters */
1680 /* if (r_ptr->flags1 & (RF1_UNIQUE)) return (FALSE); */
1681 /* if (r_ptr->flags7 & (RF7_UNIQUE_7)) return (FALSE); */
1683 if (r_ptr->flags1 & (RF1_NEVER_MOVE)) return (FALSE);
1684 if (r_ptr->flags2 & (RF2_MULTIPLY)) return (FALSE);
1685 if (r_ptr->flags2 & (RF2_QUANTUM)) return (FALSE);
1686 if (r_ptr->flags7 & (RF7_AQUATIC)) return (FALSE);
1687 if (r_ptr->flags7 & (RF7_CHAMELEON)) return (FALSE);
1689 for (i = 0; i < 4; i++)
1691 if (r_ptr->blow[i].method == RBM_EXPLODE) return (FALSE);
1692 if (r_ptr->blow[i].effect != RBE_DR_MANA) dam += r_ptr->blow[i].d_dice;
1694 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);
1700 void battle_monsters(void)
1707 bool old_inside_battle = p_ptr->inside_battle;
1709 for (i = 0; i < max_d_idx; i++)
1710 if (max_dl < max_dlv[i]) max_dl = max_dlv[i];
1712 mon_level = randint1(MIN(max_dl, 122))+5;
1713 if (randint0(100) < 60)
1715 i = randint1(MIN(max_dl, 122))+5;
1716 mon_level = MAX(i, mon_level);
1718 if (randint0(100) < 30)
1720 i = randint1(MIN(max_dl, 122))+5;
1721 mon_level = MAX(i, mon_level);
1733 get_mon_num_prep(vault_aux_battle, NULL);
1734 p_ptr->inside_battle = TRUE;
1735 r_idx = get_mon_num(mon_level);
1736 p_ptr->inside_battle = old_inside_battle;
1737 if (!r_idx) continue;
1739 if ((r_info[r_idx].flags1 & RF1_UNIQUE) || (r_info[r_idx].flags7 & RF7_UNIQUE2))
1741 if ((r_info[r_idx].level + 10) > mon_level) continue;
1744 for (j = 0; j < i; j++)
1745 if(r_idx == battle_mon[j]) break;
1750 battle_mon[i] = r_idx;
1751 if (r_info[r_idx].level < 45) tekitou = TRUE;
1756 monster_race *r_ptr = &r_info[battle_mon[i]];
1757 int num_taisei = count_bits(r_ptr->flags3 & (RF3_IM_ACID | RF3_IM_ELEC | RF3_IM_FIRE | RF3_IM_COLD | RF3_IM_POIS));
1759 if (r_ptr->flags1 & RF1_FORCE_MAXHP)
1760 power[i] = r_ptr->hdice * r_ptr->hside * 2;
1762 power[i] = r_ptr->hdice * (r_ptr->hside + 1);
1763 power[i] = power[i] * (100 + r_ptr->level) / 100;
1764 if (r_ptr->speed > 110)
1765 power[i] = power[i] * (r_ptr->speed * 2 - 110) / 100;
1766 if (r_ptr->speed < 110)
1767 power[i] = power[i] * (r_ptr->speed - 20) / 100;
1769 power[i] = power[i] * (num_taisei*2+5) / 10;
1770 else if (r_ptr->flags6 & RF6_INVULNER)
1771 power[i] = power[i] * 4 / 3;
1772 else if (r_ptr->flags6 & RF6_HEAL)
1773 power[i] = power[i] * 4 / 3;
1774 else if (r_ptr->flags5 & RF5_DRAIN_MANA)
1775 power[i] = power[i] * 11 / 10;
1776 if (r_ptr->flags1 & RF1_RAND_25)
1777 power[i] = power[i] * 9 / 10;
1778 if (r_ptr->flags1 & RF1_RAND_50)
1779 power[i] = power[i] * 9 / 10;
1781 switch (battle_mon[i])
1792 case MON_UND_BEHOLDER:
1793 case MON_SANTACLAUS:
1794 case MON_ULT_BEHOLDER:
1796 case MON_ATLACH_NACHA:
1798 power[i] = power[i] * 3 / 5;
1800 case MON_ROBIN_HOOD:
1804 case MON_CRYPT_THING:
1805 case MON_MASTER_LICH:
1806 case MON_DREADMASTER:
1808 case MON_SHADOWLORD:
1813 case MON_VENOM_WYRM:
1814 case MON_MASTER_MYS:
1815 case MON_G_MASTER_MYS:
1816 power[i] = power[i] * 3 / 4;
1818 case MON_VORPAL_BUNNY:
1821 case MON_LOG_MASTER:
1823 case MON_GRAV_HOUND:
1826 case MON_CLUB_DEMON:
1828 case MON_NIGHTCRAWLER:
1829 case MON_NIGHTWALKER:
1835 case MON_SPECT_WYRM:
1840 power[i] = power[i] * 4 / 3;
1842 case MON_UMBER_HULK:
1846 case MON_ENERGY_VOR:
1850 case MON_PLASMA_VOR:
1855 case MON_STORMBRINGER:
1856 case MON_TIME_HOUND:
1857 case MON_PLASMA_HOUND:
1860 case MON_AETHER_VOR:
1861 case MON_AETHER_HOUND:
1869 case MON_D_ELF_SHADE:
1870 case MON_MANA_HOUND:
1872 case MON_BANORLUPART:
1877 power[i] = power[i] * 3 / 2;
1881 case MON_CYBER_KING:
1882 case MON_UNICORN_ORD:
1883 power[i] = power[i] * 5 / 3;
1887 case MON_WYRM_POWER:
1907 power[i] = total*60/power[i];
1908 if (tekitou && ((power[i] < 160) || power[i] > 1500)) break;
1909 if ((power[i] < 160) && randint0(20)) break;
1910 if (power[i] < 101) power[i] = 100 + randint1(5);
1911 mon_odds[i] = power[i];
1917 static bool kakutoujou(void)
1921 char out_val[160], tmp_str[80];
1924 if ((turn - old_battle) > 5000)
1936 msg_print("¤ª¤¤¡ª¤ª¤Þ¤¨°ìʸ¤Ê¤·¤¸¤ã¤Ê¤¤¤«¡ª¤³¤Ã¤«¤é½Ð¤Æ¤¤¤±¡ª");
1938 msg_print("Hey! You don't have gold - get out of here!");
1952 prt("¥â¥ó¥¹¥¿¡¼ ÇÜΨ", 4, 4);
1954 prt("Monsters Odds", 4, 4);
1959 monster_race *r_ptr = &r_info[battle_mon[i]];
1962 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);
1964 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);
1970 prt("¤É¤ì¤ËÅÒ¤±¤Þ¤¹¤«:", 0, 0);
1972 prt("Which monster: ", 0, 0);
1983 if (i >= '1' && i <= '4')
1985 sel_monster = i-'1';
1986 battle_odds = mon_odds[sel_monster];
1994 if (i !=sel_monster) clear_bldg(i+5,i+5);
1996 maxbet = p_ptr->lev * 200;
1998 /* We can't bet more than we have */
1999 maxbet = MIN(maxbet, p_ptr->au);
2002 strcpy(out_val, "");
2004 sprintf(tmp_str,"ÅÒ¤±¶â (1-%ld)¡©", maxbet);
2006 sprintf(tmp_str,"Your wager (1-%ld) ? ", maxbet);
2011 * Use get_string() because we may need more than
2012 * the s16b value returned by get_quantity().
2014 if (get_string(tmp_str, out_val, 32))
2017 for (p = out_val; *p == ' '; p++);
2022 if (wager > p_ptr->au)
2025 msg_print("¤ª¤¤¡ª¶â¤¬Â¤ê¤Ê¤¤¤¸¤ã¤Ê¤¤¤«¡ª½Ð¤Æ¤¤¤±¡ª");
2027 msg_print("Hey! You don't have the gold - get out of here!");
2034 else if (wager > maxbet)
2037 msg_format("%ld¥´¡¼¥ë¥É¤À¤±¼õ¤±¤è¤¦¡£»Ä¤ê¤Ï¼è¤Ã¤È¤¤Ê¡£", maxbet);
2039 msg_format("I'll take %ld gold of that. Keep the rest.", maxbet);
2047 msg_print("£Ï£Ë¡¢£±¥´¡¼¥ë¥É¤Ç¤¤¤³¤¦¡£");
2049 msg_print("Ok, we'll start with 1 gold.");
2056 battle_odds = MAX(wager+1, wager * battle_odds / 100);
2059 p_ptr->leftbldg = TRUE;
2060 p_ptr->inside_battle = TRUE;
2062 p_ptr->leaving = TRUE;
2074 static void today_target(void)
2077 monster_race *r_ptr = &r_info[today_mon];
2081 c_put_str(TERM_YELLOW, "ËÜÆü¤Î¾Þ¶â¼ó", 5, 10);
2083 prt("Wanted monster that changes from day to day", 5, 10);
2086 sprintf(buf,"¥¿¡¼¥²¥Ã¥È¡§ %s",r_name + r_ptr->name);
2088 sprintf(buf,"target: %s",r_name + r_ptr->name);
2090 c_put_str(TERM_YELLOW, buf, 6, 10);
2092 sprintf(buf,"»àÂÎ ---- $%d",r_ptr->level * 50 + 100);
2094 sprintf(buf,"corpse ---- $%d",r_ptr->level * 50 + 100);
2098 sprintf(buf,"¹ü ---- $%d",r_ptr->level * 30 + 60);
2100 sprintf(buf,"skeleton ---- $%d",r_ptr->level * 30 + 60);
2103 p_ptr->today_mon = today_mon;
2106 static void tsuchinoko(void)
2110 c_put_str(TERM_YELLOW, "°ì³ÍÀé¶â¤ÎÂç¥Á¥ã¥ó¥¹¡ª¡ª¡ª", 5, 10);
2111 c_put_str(TERM_YELLOW, "¥¿¡¼¥²¥Ã¥È¡§¸¸¤ÎÄÁ½Ã¡Ö¥Ä¥Á¥Î¥³¡×", 6, 10);
2112 c_put_str(TERM_WHITE, "À¸¤±Êá¤ê ---- $1,000,000", 8, 10);
2113 c_put_str(TERM_WHITE, "»àÂÎ ---- $200,000", 9, 10);
2114 c_put_str(TERM_WHITE, "¹ü ---- $100,000", 10, 10);
2116 c_put_str(TERM_YELLOW, "Big chance to quick money!!!", 5, 10);
2117 c_put_str(TERM_YELLOW, "target: the rarest animal 'Tsuchinoko'", 6, 10);
2118 c_put_str(TERM_WHITE, "catch alive ---- $1,000,000", 8, 10);
2119 c_put_str(TERM_WHITE, "corpse ---- $200,000", 9, 10);
2120 c_put_str(TERM_WHITE, "bones ---- $100,000", 10, 10);
2124 static void shoukinkubi(void)
2132 prt("»àÂΤò»ý¤Áµ¢¤ë¤È¾Þ¶â¤òº¹¤·¾å¤²¤Þ¤¹¡£",4 ,10);
2133 c_put_str(TERM_YELLOW, "¸½ºß¤Î¾Þ¶â¼ó", 6, 10);
2135 prt("Offer a prize when you bring a wanted monster's corpse",4 ,10);
2136 c_put_str(TERM_YELLOW, "Wanted monsters", 6, 10);
2139 for (i = 0; i < MAX_KUBI; i++)
2142 monster_race *r_ptr = &r_info[(kubi_r_idx[i] > 10000 ? kubi_r_idx[i] - 10000 : kubi_r_idx[i])];
2144 sprintf(buf,"%-40s ---- ",r_name + r_ptr->name);
2146 if (kubi_r_idx[i] > 10000)
2148 c_put_str(TERM_RED,"ºÑ", y+7, 56);
2150 c_put_str(TERM_RED,"done", y+7, 56);
2154 sprintf(buf,"$%d", 300 * (r_ptr->level + 1));
2158 if (!y && (i < MAX_KUBI -1))
2161 prt("²¿¤«¥¡¼¤ò²¡¤·¤Æ¤¯¤À¤µ¤¤", 0, 0);
2163 prt("Hit any key.", 0, 0);
2172 static bool kankin(void)
2175 bool change = FALSE;
2176 char o_name[MAX_NLEN];
2179 for (i = 0;i <= INVEN_LARM; i++)
2181 o_ptr = &inventory[i];
2182 if ((o_ptr->tval == TV_CAPTURE) && (o_ptr->pval == MON_TSUCHINOKO))
2184 char buf[MAX_NLEN+20];
2185 object_desc(o_name, o_ptr, TRUE, 3);
2187 sprintf(buf, "%s ¤ò´¹¶â¤·¤Þ¤¹¤«¡©",o_name);
2189 sprintf(buf, "Convert %s into maney? ",o_name);
2194 msg_format("¾Þ¶â %ld¡ð¤ò¼ê¤ËÆþ¤ì¤¿¡£", 1000000L * o_ptr->number);
2196 msg_format("You get %ldgp.", 1000000L * o_ptr->number);
2198 p_ptr->au += 1000000L * o_ptr->number;
2199 p_ptr->redraw |= (PR_GOLD);
2200 inven_item_increase(i, -o_ptr->number);
2201 inven_item_describe(i);
2202 inven_item_optimize(i);
2207 for (i = 0;i <= INVEN_LARM; i++)
2209 o_ptr = &inventory[i];
2210 if ((o_ptr->tval == TV_CORPSE) && (o_ptr->sval == SV_CORPSE) && (o_ptr->pval == MON_TSUCHINOKO))
2212 char buf[MAX_NLEN+20];
2213 object_desc(o_name, o_ptr, TRUE, 3);
2215 sprintf(buf, "%s ¤ò´¹¶â¤·¤Þ¤¹¤«¡©",o_name);
2217 sprintf(buf, "Convert %s into maney? ",o_name);
2222 msg_format("¾Þ¶â %ld¡ð¤ò¼ê¤ËÆþ¤ì¤¿¡£", 200000L * o_ptr->number);
2224 msg_format("You get %ldgp.", 200000L * o_ptr->number);
2226 p_ptr->au += 200000L * o_ptr->number;
2227 p_ptr->redraw |= (PR_GOLD);
2228 inven_item_increase(i, -o_ptr->number);
2229 inven_item_describe(i);
2230 inven_item_optimize(i);
2235 for (i = 0;i <= INVEN_LARM; i++)
2237 o_ptr = &inventory[i];
2238 if ((o_ptr->tval == TV_CORPSE) && (o_ptr->sval == SV_SKELETON) && (o_ptr->pval == MON_TSUCHINOKO))
2240 char buf[MAX_NLEN+20];
2241 object_desc(o_name, o_ptr, TRUE, 3);
2243 sprintf(buf, "%s ¤ò´¹¶â¤·¤Þ¤¹¤«¡©",o_name);
2245 sprintf(buf, "Convert %s into maney? ",o_name);
2250 msg_format("¾Þ¶â %ld¡ð¤ò¼ê¤ËÆþ¤ì¤¿¡£", 100000L * o_ptr->number);
2252 msg_format("You get %ldgp.", 100000L * o_ptr->number);
2254 p_ptr->au += 100000L * o_ptr->number;
2255 p_ptr->redraw |= (PR_GOLD);
2256 inven_item_increase(i, -o_ptr->number);
2257 inven_item_describe(i);
2258 inven_item_optimize(i);
2264 for (i = 0;i <= INVEN_LARM; i++)
2266 o_ptr = &inventory[i];
2267 if ((o_ptr->tval == TV_CORPSE) && (o_ptr->sval == SV_CORPSE) && (o_ptr->pval == today_mon))
2269 char buf[MAX_NLEN+20];
2270 object_desc(o_name, o_ptr, TRUE, 3);
2272 sprintf(buf, "%s ¤ò´¹¶â¤·¤Þ¤¹¤«¡©",o_name);
2274 sprintf(buf, "Convert %s into maney? ",o_name);
2279 msg_format("¾Þ¶â %ld¡ð¤ò¼ê¤ËÆþ¤ì¤¿¡£", (r_info[today_mon].level * 50 + 100) * o_ptr->number);
2281 msg_format("You get %ldgp.", (r_info[today_mon].level * 50 + 100) * o_ptr->number);
2283 p_ptr->au += (r_info[today_mon].level * 50 + 100) * 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);
2292 for (i = 0;i <= INVEN_LARM; i++)
2294 o_ptr = &inventory[i];
2295 if ((o_ptr->tval == TV_CORPSE) && (o_ptr->sval == SV_SKELETON) && (o_ptr->pval == today_mon))
2297 char buf[MAX_NLEN+20];
2298 object_desc(o_name, o_ptr, TRUE, 3);
2300 sprintf(buf, "%s ¤ò´¹¶â¤·¤Þ¤¹¤«¡©",o_name);
2302 sprintf(buf, "Convert %s into maney? ",o_name);
2307 msg_format("¾Þ¶â %ld¡ð¤ò¼ê¤ËÆþ¤ì¤¿¡£", (r_info[today_mon].level * 30 + 60) * o_ptr->number);
2309 msg_format("You get %ldgp.", (r_info[today_mon].level * 30 + 60) * o_ptr->number);
2311 p_ptr->au += (r_info[today_mon].level * 30 + 60) * o_ptr->number;
2312 p_ptr->redraw |= (PR_GOLD);
2313 inven_item_increase(i, -o_ptr->number);
2314 inven_item_describe(i);
2315 inven_item_optimize(i);
2321 for (j = 0; j < MAX_KUBI; j++)
2323 for (i = 0;i <= INVEN_LARM; i++)
2325 o_ptr = &inventory[i];
2326 if ((o_ptr->tval == TV_CORPSE) && (o_ptr->sval == SV_CORPSE) && (o_ptr->pval == kubi_r_idx[j]))
2328 char buf[MAX_NLEN+20];
2329 object_desc(o_name, o_ptr, TRUE, 3);
2331 sprintf(buf, "%s ¤ò´¹¶â¤·¤Þ¤¹¤«¡©",o_name);
2333 sprintf(buf, "Convert %s into maney? ",o_name);
2338 msg_format("¾Þ¶â %ld¡ð¤ò¼ê¤ËÆþ¤ì¤¿¡£", (r_info[kubi_r_idx[j]].level + 1) * 300 * o_ptr->number);
2340 msg_format("You get %ldgp.", (r_info[kubi_r_idx[j]].level + 1) * 300 * o_ptr->number);
2342 p_ptr->au += (r_info[kubi_r_idx[j]].level+1) * 300 * o_ptr->number;
2343 p_ptr->redraw |= (PR_GOLD);
2344 inven_item_increase(i, -o_ptr->number);
2345 inven_item_describe(i);
2346 inven_item_optimize(i);
2347 chg_virtue(V_JUSTICE, 5);
2348 kubi_r_idx[j] += 10000;
2358 msg_print("¾Þ¶â¤òÆÀ¤é¤ì¤½¤¦¤Ê¤â¤Î¤Ï»ý¤Ã¤Æ¤¤¤Ê¤«¤Ã¤¿¡£");
2360 msg_print("You have nothing.");
2368 bool get_nightmare(int r_idx)
2370 monster_race *r_ptr = &r_info[r_idx];
2372 /* Require eldritch horrors */
2373 if (!(r_ptr->flags2 & (RF2_ELDRITCH_HORROR))) return (FALSE);
2375 /* Require high level */
2376 if (r_ptr->level <= p_ptr->lev) return (FALSE);
2378 /* Accept this monster */
2383 void have_nightmare(int r_idx)
2385 bool happened = FALSE;
2389 monster_race *r_ptr = &r_info[r_idx];
2392 cptr desc = r_name + r_ptr->name;
2395 power = r_ptr->level + 10;
2400 if (!(r_ptr->flags1 & RF1_UNIQUE))
2405 sprintf(m_name, "%s %s", (is_a_vowel(desc[0]) ? "an" : "a"), desc);
2407 if (r_ptr->flags1 & RF1_FRIENDS)
2415 sprintf(m_name, "%s", desc);
2420 if (saving_throw(p_ptr->skill_sav * 100 / power))
2423 msg_format("Ì´¤ÎÃæ¤Ç%s¤ËÄɤ¤¤«¤±¤é¤ì¤¿¡£", m_name);
2425 msg_format("%^s chases you through your dreams.", m_name);
2435 /* Something silly happens... */
2437 msg_format("%s%s¤Î´é¤ò¸«¤Æ¤·¤Þ¤Ã¤¿¡ª",
2439 msg_format("You behold the %s visage of %s!",
2442 funny_desc[randint0(MAX_SAN_FUNNY)], m_name);
2446 msg_print(funny_comments[randint0(MAX_SAN_COMMENT)]);
2447 p_ptr->image = p_ptr->image + randint1(r_ptr->level);
2450 /* Never mind; we can't see it clearly enough */
2454 /* Something frightening happens... */
2456 msg_format("%s%s¤Î´é¤ò¸«¤Æ¤·¤Þ¤Ã¤¿¡ª",
2458 msg_format("You behold the %s visage of %s!",
2461 horror_desc[randint0(MAX_SAN_HORROR)], desc);
2463 r_ptr->r_flags2 |= RF2_ELDRITCH_HORROR;
2465 switch(p_ptr->prace)
2467 /* Imps may make a saving throw */
2471 if (saving_throw(20 + p_ptr->lev)) return;
2473 /* Undead may make a saving throw */
2479 if (saving_throw(10 + p_ptr->lev)) return;
2484 if (!saving_throw(p_ptr->skill_sav * 100 / power))
2486 if (!p_ptr->resist_conf)
2488 (void)set_confused(p_ptr->confused + randint0(4) + 4);
2490 if (!p_ptr->resist_chaos && one_in_(3))
2492 (void)set_image(p_ptr->image + randint0(250) + 150);
2497 /* Lose int & wis */
2498 if (!saving_throw(p_ptr->skill_sav * 100 / power))
2506 if (!saving_throw(p_ptr->skill_sav * 100 / power))
2508 if (!p_ptr->resist_conf)
2510 (void)set_confused(p_ptr->confused + randint0(4) + 4);
2512 if (!p_ptr->free_act)
2514 (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
2516 while (!saving_throw(p_ptr->skill_sav))
2518 (void)do_dec_stat(A_INT);
2520 while (!saving_throw(p_ptr->skill_sav))
2522 (void)do_dec_stat(A_WIS);
2524 if (!p_ptr->resist_chaos)
2526 (void)set_image(p_ptr->image + randint0(250) + 150);
2533 if (!saving_throw(p_ptr->skill_sav * 100 / power))
2535 if (lose_all_info())
2538 msg_print("¤¢¤Þ¤ê¤Î¶²ÉݤËÁ´¤Æ¤Î¤³¤È¤ò˺¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª");
2540 msg_print("You forget everything in your utmost terror!");
2547 /* Else gain permanent insanity */
2548 if ((p_ptr->muta3 & MUT3_MORONIC) && (p_ptr->muta2 & MUT2_BERS_RAGE) &&
2549 ((p_ptr->muta2 & MUT2_COWARDICE) || (p_ptr->resist_fear)) &&
2550 ((p_ptr->muta2 & MUT2_HALLU) || (p_ptr->resist_chaos)))
2552 /* The poor bastard already has all possible insanities! */
2558 switch (randint1(4))
2562 if (!(p_ptr->muta3 & MUT3_MORONIC))
2564 if ((p_ptr->stat_use[A_INT] < 4) && (p_ptr->stat_use[A_WIS] < 4))
2567 msg_print("¤¢¤Ê¤¿¤Ï´°àú¤ÊÇϼ¯¤Ë¤Ê¤Ã¤¿¤è¤¦¤Êµ¤¤¬¤·¤¿¡£¤·¤«¤·¤½¤ì¤Ï¸µ¡¹¤À¤Ã¤¿¡£");
2569 msg_print("You turn into an utter moron!");
2575 msg_print("¤¢¤Ê¤¿¤Ï´°àú¤ÊÇϼ¯¤Ë¤Ê¤Ã¤¿¡ª");
2577 msg_print("You turn into an utter moron!");
2581 if (p_ptr->muta3 & MUT3_HYPER_INT)
2584 msg_print("¤¢¤Ê¤¿¤ÎǾ¤ÏÀ¸ÂÎ¥³¥ó¥Ô¥å¡¼¥¿¤Ç¤Ï¤Ê¤¯¤Ê¤Ã¤¿¡£");
2586 msg_print("Your brain is no longer a living computer.");
2589 p_ptr->muta3 &= ~(MUT3_HYPER_INT);
2591 p_ptr->muta3 |= MUT3_MORONIC;
2598 if (!(p_ptr->muta2 & MUT2_COWARDICE) && !p_ptr->resist_fear)
2601 msg_print("¤¢¤Ê¤¿¤Ï¥Ñ¥é¥Î¥¤¥¢¤Ë¤Ê¤Ã¤¿¡ª");
2603 msg_print("You become paranoid!");
2607 /* Duh, the following should never happen, but anyway... */
2608 if (p_ptr->muta3 & MUT3_FEARLESS)
2611 msg_print("¤¢¤Ê¤¿¤Ï¤â¤¦¶²¤ìÃΤ餺¤Ç¤Ï¤Ê¤¯¤Ê¤Ã¤¿¡£");
2613 msg_print("You are no longer fearless.");
2616 p_ptr->muta3 &= ~(MUT3_FEARLESS);
2619 p_ptr->muta2 |= MUT2_COWARDICE;
2626 if (!(p_ptr->muta2 & MUT2_HALLU) && !p_ptr->resist_chaos)
2629 msg_print("¸¸³Ð¤ò¤Ò¤µ¯¤³¤¹Àº¿ÀºøÍð¤Ë´Ù¤Ã¤¿¡ª");
2631 msg_print("You are afflicted by a hallucinatory insanity!");
2634 p_ptr->muta2 |= MUT2_HALLU;
2641 if (!(p_ptr->muta2 & MUT2_BERS_RAGE))
2644 msg_print("·ãÎõ¤Ê´¶¾ð¤Îȯºî¤Ë¤ª¤½¤ï¤ì¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¡ª");
2646 msg_print("You become subject to fits of berserk rage!");
2649 p_ptr->muta2 |= MUT2_BERS_RAGE;
2657 p_ptr->update |= PU_BONUS;
2664 * Note that resting for the night was a perfect way to avoid player
2665 * ghosts in the town *if* you could only make it to the inn in time (-:
2666 * Now that the ghosts are temporarily disabled in 2.8.X, this function
2667 * will not be that useful. I will keep it in the hopes the player
2668 * ghost code does become a reality again. Does help to avoid filthy urchins.
2669 * Resting at night is also a quick way to restock stores -KMW-
2671 static bool inn_comm(int cmd)
2677 case BACT_FOOD: /* Buy food & drink */
2679 msg_print("¥Ð¡¼¥Æ¥ó¤Ï¤¤¤¯¤é¤«¤Î¿©¤Ùʪ¤È¥Ó¡¼¥ë¤ò¤¯¤ì¤¿¡£");
2681 msg_print("The barkeep gives you some gruel and a beer.");
2684 (void)set_food(PY_FOOD_MAX - 1);
2687 case BACT_REST: /* Rest for the night */
2688 dawnval = ((turn % (20L * TOWN_DAWN)));
2689 if (dawnval > 50000)
2691 if ((p_ptr->poisoned) || (p_ptr->cut))
2694 msg_print("¤¢¤Ê¤¿¤ËɬÍפʤΤÏÉô²°¤Ç¤Ï¤Ê¤¯¡¢¼£ÎżԤǤ¹¡£");
2696 msg_print("You need a healer, not a room.");
2701 msg_print("¤¹¤ß¤Þ¤»¤ó¡¢¤Ç¤â¤¦¤Á¤Ç狼¤Ë»à¤Ê¤ì¤Á¤ãº¤¤ê¤Þ¤¹¤ó¤Ç¡£");
2703 msg_print("Sorry, but don't want anyone dying in here.");
2711 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "½É²°¤ËÇñ¤Þ¤Ã¤¿¡£");
2713 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "stay over night at the inn");
2715 turn = ((turn / 100000) + 1) * 100000;
2716 if (((oldturn + 5L * TOWN_DAWN) % (20L * TOWN_DAWN)) > 50000L) do_cmd_write_nikki(NIKKI_HIGAWARI, 0, NULL);
2717 p_ptr->chp = p_ptr->mhp;
2719 dungeon_turn += MIN(turn - oldturn, 5000);
2721 if (ironman_nightmare)
2724 msg_print("̲¤ê¤Ë½¢¤¯¤È¶²¤í¤·¤¤¸÷·Ê¤¬¿´¤ò¤è¤®¤Ã¤¿¡£");
2726 msg_print("Horrible visions flit through your mind as you sleep.");
2730 /* Pick a nightmare */
2731 get_mon_num_prep(get_nightmare, NULL);
2733 /* Have some nightmares */
2736 have_nightmare(get_mon_num(MAX_DEPTH));
2738 if (!one_in_(3)) break;
2741 /* Remove the monster restriction */
2742 get_mon_num_prep(NULL, NULL);
2745 msg_print("¤¢¤Ê¤¿¤ÏÀ䶫¤·¤ÆÌܤò³Ð¤Þ¤·¤¿¡£");
2747 msg_print("You awake screaming.");
2751 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "°Ì´¤Ë¤¦¤Ê¤µ¤ì¤Æ¤è¤¯Ì²¤ì¤Ê¤«¤Ã¤¿¡£");
2753 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "be troubled by a nightmare.");
2761 p_ptr->chp = p_ptr->mhp;
2762 p_ptr->csp = p_ptr->msp;
2763 if (p_ptr->pclass == CLASS_MAGIC_EATER)
2766 for (i = 0; i < 72; i++)
2768 p_ptr->magic_num1[i] = p_ptr->magic_num2[i]*0x10000;
2770 for (; i < 108; i++)
2772 p_ptr->magic_num1[i] = 0;
2777 msg_print("¤¢¤Ê¤¿¤Ï¥ê¥Õ¥ì¥Ã¥·¥å¤·¤ÆÌܳФᡢ¿·¤¿¤ÊÆü¤ò·Þ¤¨¤¿¡£");
2779 msg_print("You awake refreshed for the new day.");
2783 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "¤¹¤¬¤¹¤¬¤·¤¤Ä«¤ò¤à¤«¤¨¤¿¡£");
2785 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "awake refreshed.");
2789 p_ptr->leftbldg = TRUE;
2795 msg_print("Éô²°¤ÏÌë¤À¤±»ÈÍѲÄǽ¤Ç¤¹¡£");
2797 msg_print("The rooms are available only at night.");
2803 case BACT_RUMORS: /* Listen for rumors */
2808 if (!get_rnd_line_jonly("rumors_j.txt", 0, Rumor, 10))
2810 if (!get_rnd_line("rumors.txt", 0, Rumor))
2813 msg_format("%s", Rumor);
2823 * Share gold for thieves
2825 static void share_gold(void)
2827 int i = (p_ptr->lev * 2) * 10;
2829 msg_format("¡ð%d ¤ò¼ê¤ËÆþ¤ì¤¿¡£", i);
2831 msg_format("You collect %d gold pieces", i);
2839 * Display quest information
2841 static void get_questinfo(int questnum)
2848 /* Clear the text */
2849 for (i = 0; i < 10; i++)
2851 quest_text[i][0] = '\0';
2854 quest_text_line = 0;
2856 /* Set the quest number temporary */
2857 old_quest = p_ptr->inside_quest;
2858 p_ptr->inside_quest = questnum;
2860 /* Get the quest text */
2861 init_flags = INIT_SHOW_TEXT | INIT_ASSIGN;
2863 process_dungeon_file("q_info_j.txt", 0, 0, 0, 0);
2865 /* Reset the old quest number */
2866 p_ptr->inside_quest = old_quest;
2868 /* Print the quest info */
2870 sprintf(tmp_str, "¥¯¥¨¥¹¥È¾ðÊó (´í¸±ÅÙ: %d ³¬ÁêÅö)", quest[questnum].level);
2872 sprintf(tmp_str, "Quest Information (Danger level: %d)", quest[questnum].level);
2877 prt(quest[questnum].name, 7, 0);
2879 for (i = 0; i < 10; i++)
2881 c_put_str(TERM_YELLOW, quest_text[i], i + 8, 0);
2887 * Request a quest from the Lord.
2889 static void castle_quest(void)
2892 monster_race *r_ptr;
2899 /* Current quest of the building */
2900 q_index = cave[py][px].special;
2902 /* Is there a quest available at the building? */
2906 put_str("º£¤Î¤È¤³¤í¥¯¥¨¥¹¥È¤Ï¤¢¤ê¤Þ¤»¤ó¡£", 8, 0);
2908 put_str("I don't have a quest for you at the moment.", 8, 0);
2914 q_ptr = &quest[q_index];
2916 /* Quest is completed */
2917 if (q_ptr->status == QUEST_STATUS_COMPLETED)
2919 /* Rewarded quest */
2920 q_ptr->status = QUEST_STATUS_REWARDED;
2922 get_questinfo(q_index);
2924 reinit_wilderness = TRUE;
2927 else if (q_ptr->status == QUEST_STATUS_FAILED)
2929 get_questinfo(q_index);
2931 /* Mark quest as done (but failed) */
2932 q_ptr->status = QUEST_STATUS_FAILED_DONE;
2934 reinit_wilderness = TRUE;
2936 /* Quest is still unfinished */
2937 else if (q_ptr->status == QUEST_STATUS_TAKEN)
2940 put_str("¤¢¤Ê¤¿¤Ï¸½ºß¤Î¥¯¥¨¥¹¥È¤ò½ªÎ»¤µ¤»¤Æ¤¤¤Þ¤»¤ó¡ª", 8, 0);
2942 put_str("You have not completed your current quest yet!", 8, 0);
2946 put_str("CTRL-Q¤ò»È¤¨¤Ð¥¯¥¨¥¹¥È¤Î¾õÂÖ¤¬¥Á¥§¥Ã¥¯¤Ç¤¤Þ¤¹¡£", 9, 0);
2948 put_str("Use CTRL-Q to check the status of your quest.", 9, 0);
2952 put_str("¥¯¥¨¥¹¥È¤ò½ª¤ï¤é¤»¤¿¤éÌá¤Ã¤ÆÍè¤Æ²¼¤µ¤¤¡£", 12, 0);
2954 put_str("Return when you have completed your quest.", 12, 0);
2959 else if (q_ptr->status == QUEST_STATUS_UNTAKEN)
2961 q_ptr->status = QUEST_STATUS_TAKEN;
2963 reinit_wilderness = TRUE;
2965 /* Assign a new quest */
2966 if (q_ptr->type == QUEST_TYPE_KILL_ANY_LEVEL)
2968 if (q_ptr->r_idx == 0)
2970 /* Random monster at least 5 - 10 levels out of deep */
2971 q_ptr->r_idx = get_mon_num(q_ptr->level + 4 + randint1(6));
2974 r_ptr = &r_info[q_ptr->r_idx];
2976 while ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->rarity != 1))
2978 q_ptr->r_idx = get_mon_num(q_ptr->level) + 4 + randint1(6);
2979 r_ptr = &r_info[q_ptr->r_idx];
2982 if (q_ptr->max_num == 0)
2984 /* Random monster number */
2985 if (randint1(10) > 7)
2988 q_ptr->max_num = randint1(3) + 1;
2992 name = (r_name + r_ptr->name);
2994 msg_format("¥¯¥¨¥¹¥È: %s¤ò %dÂÎÅݤ¹", name,q_ptr->max_num);
2996 msg_format("Your quest: kill %d %s", q_ptr->max_num, name);
3002 get_questinfo(q_index);
3009 * Display town history
3011 static void town_history(void)
3016 /* Peruse the building help file */
3018 (void)show_file(TRUE, "bldg_j.txt", NULL, 0, 0);
3020 (void)show_file(TRUE, "bldg.txt", NULL, 0, 0);
3030 * Display the damage figure of an object
3031 * (used by compare_weapon_aux1)
3033 * Only accurate for the current weapon, because it includes
3034 * the current +dam of the player.
3036 static void compare_weapon_aux2(object_type *o_ptr, int numblows,
3037 int r, int c, int mult, char attr[80],
3038 u32b f1, u32b f2, u32b f3, byte color)
3042 /* Print the intro text */
3043 c_put_str(color, attr, r, c);
3045 /* Calculate the min and max damage figures */
3047 sprintf(tmp_str, "£±¥¿¡¼¥ó: %d-%d ¥À¥á¡¼¥¸",
3049 sprintf(tmp_str, "Attack: %d-%d damage",
3052 (numblows * (mult * o_ptr->dd /60 + o_ptr->to_d + p_ptr->to_d[0])),
3053 (numblows * (mult * o_ptr->ds * o_ptr->dd /60 + o_ptr->to_d + p_ptr->to_d[0])));
3055 /* Print the damage */
3056 put_str(tmp_str, r, c + 8);
3061 * Show the damage figures for the various monster types
3063 * Only accurate for the current weapon, because it includes
3064 * the current number of blows for the player.
3066 static void compare_weapon_aux1(object_type *o_ptr, int col, int r)
3071 /* Get the flags of the weapon */
3072 object_flags(o_ptr, &f1, &f2, &f3);
3076 if ((o_ptr->tval == TV_POLEARM) && ((o_ptr->sval == SV_LANCE) || (o_ptr->sval == SV_HEAVY_LANCE)))
3077 mult = mult * (o_ptr->dd + 2) / o_ptr->dd;
3079 if ((p_ptr->pclass != CLASS_SAMURAI) && (f1 & TR1_FORCE_WEPON) && (p_ptr->csp > (o_ptr->dd * o_ptr->ds / 5))) mult = mult * 7 / 2;
3081 /* Print the relevant lines */
3083 if (f1 & TR1_FORCE_WEPON) compare_weapon_aux2(o_ptr, p_ptr->num_blow[0], r++, col, 1*mult, "ÍýÎÏ:", f1, f2, f3, TERM_L_BLUE);
3084 if (f1 & TR1_SLAY_ANIMAL) compare_weapon_aux2(o_ptr, p_ptr->num_blow[0], r++, col, 2*mult, "ưʪ:", f1, f2, f3, TERM_YELLOW);
3085 if (f1 & TR1_SLAY_EVIL) compare_weapon_aux2(o_ptr, p_ptr->num_blow[0], r++, col, 2*mult, "¼Ù°:", f1, f2, f3, TERM_YELLOW);
3086 if (f1 & TR1_SLAY_UNDEAD) compare_weapon_aux2(o_ptr, p_ptr->num_blow[0], r++, col, 3*mult, "ÉÔ»à:", f1, f2, f3, TERM_YELLOW);
3087 if (f1 & TR1_SLAY_DEMON) compare_weapon_aux2(o_ptr, p_ptr->num_blow[0], r++, col, 3*mult, "°Ëâ:", f1, f2, f3, TERM_YELLOW);
3088 if (f1 & TR1_SLAY_ORC) compare_weapon_aux2(o_ptr, p_ptr->num_blow[0], r++, col, 3*mult, "¥ª¡¼¥¯:", f1, f2, f3, TERM_YELLOW);
3089 if (f1 & TR1_SLAY_TROLL) compare_weapon_aux2(o_ptr, p_ptr->num_blow[0], r++, col, 3*mult, "¥È¥í¥ë:", f1, f2, f3, TERM_YELLOW);
3090 if (f1 & TR1_SLAY_GIANT) compare_weapon_aux2(o_ptr, p_ptr->num_blow[0], r++, col, 3*mult, "µð¿Í:", f1, f2, f3, TERM_YELLOW);
3091 if (f1 & TR1_KILL_DRAGON) compare_weapon_aux2(o_ptr, p_ptr->num_blow[0], r++, col, 5*mult, "ε:", f1, f2, f3, TERM_YELLOW);
3092 else if (f1 & TR1_SLAY_DRAGON) compare_weapon_aux2(o_ptr, p_ptr->num_blow[0], r++, col, 3*mult, "ε:", f1, f2, f3, TERM_YELLOW);
3093 if (f1 & TR1_BRAND_ACID) compare_weapon_aux2(o_ptr, p_ptr->num_blow[0], r++, col, 5*mult/2, "»À°À:", f1, f2, f3, TERM_RED);
3094 if (f1 & TR1_BRAND_ELEC) compare_weapon_aux2(o_ptr, p_ptr->num_blow[0], r++, col, 5*mult/2, "ÅÅ°À:", f1, f2, f3, TERM_RED);
3095 if (f1 & TR1_BRAND_FIRE) compare_weapon_aux2(o_ptr, p_ptr->num_blow[0], r++, col, 5*mult/2, "±ê°À:", f1, f2, f3, TERM_RED);
3096 if (f1 & TR1_BRAND_COLD) compare_weapon_aux2(o_ptr, p_ptr->num_blow[0], r++, col, 5*mult/2, "Îä°À:", f1, f2, f3, TERM_RED);
3097 if (f1 & TR1_BRAND_POIS) compare_weapon_aux2(o_ptr, p_ptr->num_blow[0], r++, col, 5*mult/2, "ÆÇ°À:", f1, f2, f3, TERM_RED);
3099 if (f1 & TR1_FORCE_WEPON) compare_weapon_aux2(o_ptr, p_ptr->num_blow[0], r++, col, 1*mult, "Force :", f1, f2, f3, TERM_L_BLUE);
3100 if (f1 & TR1_SLAY_ANIMAL) compare_weapon_aux2(o_ptr, p_ptr->num_blow[0], r++, col, 2*mult, "Animals:", f1, f2, f3, TERM_YELLOW);
3101 if (f1 & TR1_SLAY_EVIL) compare_weapon_aux2(o_ptr, p_ptr->num_blow[0], r++, col, 2*mult, "Evil:", f1, f2, f3, TERM_YELLOW);
3102 if (f1 & TR1_SLAY_UNDEAD) compare_weapon_aux2(o_ptr, p_ptr->num_blow[0], r++, col, 3*mult, "Undead:", f1, f2, f3, TERM_YELLOW);
3103 if (f1 & TR1_SLAY_DEMON) compare_weapon_aux2(o_ptr, p_ptr->num_blow[0], r++, col, 3*mult, "Demons:", f1, f2, f3, TERM_YELLOW);
3104 if (f1 & TR1_SLAY_ORC) compare_weapon_aux2(o_ptr, p_ptr->num_blow[0], r++, col, 3*mult, "Orcs:", f1, f2, f3, TERM_YELLOW);
3105 if (f1 & TR1_SLAY_TROLL) compare_weapon_aux2(o_ptr, p_ptr->num_blow[0], r++, col, 3*mult, "Trolls:", f1, f2, f3, TERM_YELLOW);
3106 if (f1 & TR1_SLAY_GIANT) compare_weapon_aux2(o_ptr, p_ptr->num_blow[0], r++, col, 3*mult, "Giants:", f1, f2, f3, TERM_YELLOW);
3107 if (f1 & TR1_KILL_DRAGON) compare_weapon_aux2(o_ptr, p_ptr->num_blow[0], r++, col, 5*mult, "Dragons:", f1, f2, f3, TERM_YELLOW);
3108 else if (f1 & TR1_SLAY_DRAGON) compare_weapon_aux2(o_ptr, p_ptr->num_blow[0], r++, col, 3*mult, "Dragons:", f1, f2, f3, TERM_YELLOW);
3109 if (f1 & TR1_BRAND_ACID) compare_weapon_aux2(o_ptr, p_ptr->num_blow[0], r++, col, 3*mult, "Acid:", f1, f2, f3, TERM_RED);
3110 if (f1 & TR1_BRAND_ELEC) compare_weapon_aux2(o_ptr, p_ptr->num_blow[0], r++, col, 3*mult, "Elec:", f1, f2, f3, TERM_RED);
3111 if (f1 & TR1_BRAND_FIRE) compare_weapon_aux2(o_ptr, p_ptr->num_blow[0], r++, col, 3*mult, "Fire:", f1, f2, f3, TERM_RED);
3112 if (f1 & TR1_BRAND_COLD) compare_weapon_aux2(o_ptr, p_ptr->num_blow[0], r++, col, 3*mult, "Cold:", f1, f2, f3, TERM_RED);
3113 if (f1 & TR1_BRAND_POIS) compare_weapon_aux2(o_ptr, p_ptr->num_blow[0], r++, col, 3*mult, "Poison:", f1, f2, f3, TERM_RED);
3118 static int hit_chance(int to_h, int ac)
3121 int meichuu = p_ptr->skill_thn + (p_ptr->to_h[0] + to_h) * BTH_PLUS_ADJ;
3123 if (meichuu <= 0) return 5;
3125 chance = 100 - ((ac * 75) / meichuu);
3127 if (chance > 95) chance = 95;
3128 if (chance < 5) chance = 5;
3129 if (p_ptr->pseikaku == SEIKAKU_NAMAKE)
3130 chance = (chance*19+9)/20;
3135 * Displays all info about a weapon
3137 * Only accurate for the current weapon, because it includes
3138 * various info about the player's +to_dam and number of blows.
3140 static void list_weapon(object_type *o_ptr, int row, int col)
3142 char o_name[MAX_NLEN];
3145 /* Print the weapon name */
3146 object_desc(o_name, o_ptr, TRUE, 0);
3147 c_put_str(TERM_YELLOW, o_name, row, col);
3149 /* Print the player's number of blows */
3151 sprintf(tmp_str, "¹¶·â²ó¿ô: %d", p_ptr->num_blow[0]);
3153 sprintf(tmp_str, "Number of Blows: %d", p_ptr->num_blow[0]);
3156 put_str(tmp_str, row+1, col);
3158 /* Print to_hit and to_dam of the weapon */
3160 sprintf(tmp_str, "Ì¿ÃæΨ: 0 50 100 150 200 (Ũ¤ÎAC)");
3162 sprintf(tmp_str, "To Hit: 0 50 100 150 200 (AC)");
3165 put_str(tmp_str, row+2, col);
3167 /* Print the weapons base damage dice */
3169 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));
3171 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));
3174 put_str(tmp_str, row+3, col);
3177 c_put_str(TERM_YELLOW, "²Äǽ¤Ê¥À¥á¡¼¥¸:", row+5, col);
3179 c_put_str(TERM_YELLOW, "Possible Damage:", row+5, col);
3183 /* Damage for one blow (if it hits) */
3185 sprintf(tmp_str, "¹¶·â°ì²ó¤Ë¤Ä¤ %d-%d",
3187 sprintf(tmp_str, "One Strike: %d-%d damage",
3190 o_ptr->dd + o_ptr->to_d + p_ptr->to_d[0],
3191 o_ptr->ds * o_ptr->dd + o_ptr->to_d + p_ptr->to_d[0]);
3192 put_str(tmp_str, row+6, col+1);
3194 /* Damage for the complete attack (if all blows hit) */
3196 sprintf(tmp_str, "£±¥¿¡¼¥ó¤Ë¤Ä¤ %d-%d",
3198 sprintf(tmp_str, "One Attack: %d-%d damage",
3201 p_ptr->num_blow[0] * (o_ptr->dd + o_ptr->to_d + p_ptr->to_d[0]),
3202 p_ptr->num_blow[0] * (o_ptr->ds * o_ptr->dd + o_ptr->to_d + p_ptr->to_d[0]));
3203 put_str(tmp_str, row+7, col+1);
3208 * Hook to specify "weapon"
3210 static bool item_tester_hook_melee_weapon(object_type *o_ptr)
3212 switch (o_ptr->tval)
3222 if (o_ptr->sval != SV_DOKUBARI) return (TRUE);
3231 * Hook to specify "ammo"
3233 static bool item_tester_hook_ammo(object_type *o_ptr)
3235 switch (o_ptr->tval)
3252 * Copies the weapons to compare into the weapon-slot and
3253 * compares the values for both weapons.
3255 static bool compare_weapons(void)
3258 object_type *o1_ptr, *o2_ptr;
3259 object_type orig_weapon;
3265 /* Clear the screen */
3268 /* Store copy of original wielded weapon */
3269 i_ptr = &inventory[INVEN_RARM];
3270 object_copy(&orig_weapon, i_ptr);
3272 item_tester_no_ryoute = TRUE;
3273 /* Only compare melee weapons */
3274 item_tester_hook = item_tester_hook_melee_weapon;
3276 /* Get the first weapon */
3278 q = "Âè°ì¤ÎÉð´ï¤Ï¡©";
3279 s = "Èæ¤Ù¤ë¤â¤Î¤¬¤¢¤ê¤Þ¤»¤ó¡£";
3281 q = "What is your first weapon? ";
3282 s = "You have nothing to compare.";
3285 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN)))
3291 /* Get the item (in the pack) */
3292 o1_ptr = &inventory[item];
3294 /* Clear the screen */
3297 item_tester_no_ryoute = TRUE;
3298 /* Only compare melee weapons */
3299 item_tester_hook = item_tester_hook_melee_weapon;
3301 /* Get the second weapon */
3303 q = "ÂèÆó¤ÎÉð´ï¤Ï¡©";
3304 s = "Èæ¤Ù¤ë¤â¤Î¤¬¤¢¤ê¤Þ¤»¤ó¡£";
3306 q = "What is your second weapon? ";
3307 s = "You have nothing to compare.";
3310 if (!get_item(&item2, q, s, (USE_EQUIP | USE_INVEN)))
3316 /* Get the item (in the pack) */
3317 o2_ptr = &inventory[item2];
3319 /* Clear the screen */
3322 /* Copy first weapon into the weapon slot (if it's not already there) */
3323 if (o1_ptr != i_ptr)
3324 object_copy(i_ptr, o1_ptr);
3326 /* Get the new values */
3329 /* List the new values */
3330 list_weapon(o1_ptr, row, 2);
3331 compare_weapon_aux1(o1_ptr, 2, row + 8);
3333 /* Copy second weapon into the weapon slot (if it's not already there) */
3334 if (o2_ptr != i_ptr)
3335 object_copy(i_ptr, o2_ptr);
3337 object_copy(i_ptr, &orig_weapon);
3339 /* Get the new values */
3342 /* List the new values */
3343 list_weapon(o2_ptr, row, 40);
3344 compare_weapon_aux1(o2_ptr, 40, row + 8);
3346 /* Copy back the original weapon into the weapon slot */
3347 object_copy(i_ptr, &orig_weapon);
3349 /* Reset the values for the old weapon */
3353 put_str("(°ìÈֹ⤤¥À¥á¡¼¥¸¤¬Å¬ÍѤµ¤ì¤Þ¤¹¡£Ê£¿ô¤ÎÇÜÂǸú²Ì¤Ï¤·»»¤µ¤ì¤Þ¤»¤ó¡£)", row + 4, 0);
3355 put_str("(Only highest damage applies per monster. Special damage not cumulative.)", row + 4, 0);
3359 msg_print("¸½ºß¤Îµ»Î̤«¤éȽÃǤ¹¤ë¤È¡¢¤¢¤Ê¤¿¤ÎÉð´ï¤Ï°Ê²¼¤Î¤è¤¦¤Ê°ÒÎϤòȯ´ø¤·¤Þ¤¹:");
3361 msg_print("Based on your current abilities, here is what your weapons will do");
3377 static bool enchant_item(int cost, int to_hit, int to_dam, int to_ac)
3383 int maxenchant = (p_ptr->lev / 5);
3384 char tmp_str[MAX_NLEN];
3389 prt(format("¸½ºß¤Î¤¢¤Ê¤¿¤Îµ»Î̤À¤È¡¢+%d ¤Þ¤Ç²þÎɤǤ¤Þ¤¹¡£", maxenchant), 5, 0);
3390 prt(format(" ²þÎɤÎÎÁ¶â¤Ï°ì¸Ä¤Ë¤Ä¤¡ð%d ¤Ç¤¹¡£", cost), 7, 0);
3392 prt(format(" Based on your skill, we can improve up to +%d.", maxenchant), 5, 0);
3393 prt(format(" The price for the service is %d gold per item.", cost), 7, 0);
3396 item_tester_no_ryoute = TRUE;
3400 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò²þÎɤ·¤Þ¤¹¤«¡©";
3401 s = "²þÎɤǤ¤ë¤â¤Î¤¬¤¢¤ê¤Þ¤»¤ó¡£";
3403 q = "Improve which item? ";
3404 s = "You have nothing to improve.";
3407 if (!get_item(&item, q, s, (USE_INVEN | USE_EQUIP))) return (FALSE);
3409 /* Get the item (in the pack) */
3410 o_ptr = &inventory[item];
3412 /* Check if the player has enough money */
3413 if (p_ptr->au < (cost * o_ptr->number))
3415 object_desc(tmp_str, o_ptr, TRUE, 0);
3417 msg_format("%s¤ò²þÎɤ¹¤ë¤À¤±¤Î¥´¡¼¥ë¥É¤¬¤¢¤ê¤Þ¤»¤ó¡ª", tmp_str);
3419 msg_format("You do not have the gold to improve %s!", tmp_str);
3425 /* Enchant to hit */
3426 for (i = 0; i < to_hit; i++)
3428 if (o_ptr->to_h < maxenchant)
3430 if (enchant(o_ptr, 1, (ENCH_TOHIT | ENCH_FORCE)))
3438 /* Enchant to damage */
3439 for (i = 0; i < to_dam; i++)
3441 if (o_ptr->to_d < maxenchant)
3443 if (enchant(o_ptr, 1, (ENCH_TODAM | ENCH_FORCE)))
3452 for (i = 0; i < to_ac; i++)
3454 if (o_ptr->to_a < maxenchant)
3456 if (enchant(o_ptr, 1, (ENCH_TOAC | ENCH_FORCE)))
3468 if (flush_failure) flush();
3472 msg_print("²þÎɤ˼ºÇÔ¤·¤¿¡£");
3474 msg_print("The improvement failed.");
3482 object_desc(tmp_str, o_ptr, TRUE, 1);
3484 msg_format("¡ð%d ¤Ç%s¤ò²þÎɤ·¤Þ¤·¤¿¡£", cost * o_ptr->number, tmp_str );
3486 msg_format("Improved %s for %d gold.", tmp_str, cost * o_ptr->number);
3489 /* Charge the money */
3490 p_ptr->au -= (cost * o_ptr->number);
3492 if (item >= INVEN_RARM) calc_android_exp();
3494 /* Something happened */
3501 * Recharge rods, wands and staves
3503 * The player can select the number of charges to add
3504 * (up to a limit), and the recharge never fails.
3506 * The cost for rods depends on the level of the rod. The prices
3507 * for recharging wands and staves are dependent on the cost of
3510 static void building_recharge(void)
3519 char tmp_str[MAX_NLEN];
3523 /* Display some info */
3526 prt(" ºÆ½¼Å¶¤ÎÈñÍѤϥ¢¥¤¥Æ¥à¤Î¼ïÎà¤Ë¤è¤ê¤Þ¤¹¡£", 6, 0);
3528 prt(" The prices of recharge depend on the type.", 6, 0);
3532 /* Only accept legal items */
3533 item_tester_hook = item_tester_hook_recharge;
3537 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ËËâÎϤò½¼Å¶¤·¤Þ¤¹¤«? ";
3538 s = "ËâÎϤò½¼Å¶¤¹¤Ù¤¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡£";
3540 q = "Recharge which item? ";
3541 s = "You have nothing to recharge.";
3544 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
3546 /* Get the item (in the pack) */
3549 o_ptr = &inventory[item];
3552 /* Get the item (on the floor) */
3555 o_ptr = &o_list[0 - item];
3558 k_ptr = &k_info[o_ptr->k_idx];
3561 * We don't want to give the player free info about
3562 * the level of the item or the number of charges.
3564 /* The item must be "known" */
3565 if (!object_known_p(o_ptr))
3568 msg_format("½¼Å¶¤¹¤ëÁ°¤Ë´ÕÄꤵ¤ì¤Æ¤¤¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡ª");
3570 msg_format("The item must be identified first!");
3575 if ((p_ptr->au >= 50) &&
3577 get_check("¡ð50¤Ç´ÕÄꤷ¤Þ¤¹¤«¡© "))
3579 get_check("Identify for 50 gold? "))
3587 identify_item(o_ptr);
3590 object_desc(tmp_str, o_ptr, TRUE, 3);
3593 msg_format("%s ¤Ç¤¹¡£", tmp_str);
3595 msg_format("You have: %s.", tmp_str);
3599 /* Update the gold display */
3600 building_prt_gold();
3608 /* Extract the object "level" */
3609 lev = get_object_level(o_ptr);
3611 /* Price for a rod */
3612 if (o_ptr->tval == TV_ROD)
3614 if (o_ptr->timeout > 0)
3616 /* Fully recharge */
3617 price = (lev * 50 * o_ptr->timeout) / k_ptr->pval;
3621 /* No recharge necessary */
3624 msg_format("¤½¤ì¤ÏºÆ½¼Å¶¤¹¤ëɬÍפϤ¢¤ê¤Þ¤»¤ó¡£");
3626 msg_format("That doesn't need to be recharged.");
3632 else if (o_ptr->tval == TV_STAFF)
3634 /* Price per charge ( = double the price paid by shopkeepers for the charge) */
3635 price = (get_object_cost(o_ptr) / 10) * o_ptr->number;
3637 /* Pay at least 10 gold per charge */
3638 price = MAX(10, price);
3642 /* Price per charge ( = double the price paid by shopkeepers for the charge) */
3643 price = (get_object_cost(o_ptr) / 10);
3645 /* Pay at least 10 gold per charge */
3646 price = MAX(10, price);
3649 /* Limit the number of charges for wands and staffs */
3650 if (o_ptr->tval == TV_WAND
3651 && (o_ptr->pval / o_ptr->number >= k_ptr->pval))
3653 if (o_ptr->number > 1)
3656 msg_print("¤³¤ÎËâË¡ËÀ¤Ï¤â¤¦½¼Ê¬¤Ë½¼Å¶¤µ¤ì¤Æ¤¤¤Þ¤¹¡£");
3658 msg_print("These wands are already fully charged.");
3664 msg_print("¤³¤ÎËâË¡ËÀ¤Ï¤â¤¦½¼Ê¬¤Ë½¼Å¶¤µ¤ì¤Æ¤¤¤Þ¤¹¡£");
3666 msg_print("This wand is already fully charged.");
3671 else if (o_ptr->tval == TV_STAFF && o_ptr->pval >= k_ptr->pval)
3673 if (o_ptr->number > 1)
3676 msg_print("¤³¤Î¾ó¤Ï¤â¤¦½¼Ê¬¤Ë½¼Å¶¤µ¤ì¤Æ¤¤¤Þ¤¹¡£");
3678 msg_print("These staffs are already fully charged.");
3684 msg_print("¤³¤Î¾ó¤Ï¤â¤¦½¼Ê¬¤Ë½¼Å¶¤µ¤ì¤Æ¤¤¤Þ¤¹¡£");
3686 msg_print("This staff is already fully charged.");
3692 /* Check if the player has enough money */
3693 if (p_ptr->au < price)
3695 object_desc(tmp_str, o_ptr, TRUE, 0);
3697 msg_format("%s¤òºÆ½¼Å¶¤¹¤ë¤Ë¤Ï¡ð%d ɬÍפǤ¹¡ª", tmp_str,price );
3699 msg_format("You need %d gold to recharge %s!", price, tmp_str);
3705 if (o_ptr->tval == TV_ROD)
3708 if (get_check(format("¤½¤Î¥í¥Ã¥É¤ò¡ð%d ¤ÇºÆ½¼Å¶¤·¤Þ¤¹¤«¡©",
3711 if (get_check(format("Recharge the %s for %d gold? ",
3712 ((o_ptr->number > 1) ? "rods" : "rod"), price)))
3716 /* Recharge fully */
3726 if (o_ptr->tval == TV_STAFF)
3727 max_charges = k_ptr->pval - o_ptr->pval;
3729 max_charges = o_ptr->number * k_ptr->pval - o_ptr->pval;
3731 /* Get the quantity for staves and wands */
3733 charges = get_quantity(format("°ì²óʬ¡ð%d ¤Ç²¿²óʬ½¼Å¶¤·¤Þ¤¹¤«¡©",
3735 charges = get_quantity(format("Add how many charges for %d gold? ",
3738 price), MIN(p_ptr->au / price, max_charges));
3741 if (charges < 1) return;
3743 /* Get the new price */
3747 o_ptr->pval += charges;
3749 /* We no longer think the item is empty */
3750 o_ptr->ident &= ~(IDENT_EMPTY);
3754 object_desc(tmp_str, o_ptr, TRUE, 3);
3756 msg_format("%s¤ò¡ð%d ¤ÇºÆ½¼Å¶¤·¤Þ¤·¤¿¡£", tmp_str, price);
3758 msg_format("%^s %s recharged for %d gold.", tmp_str, ((o_ptr->number > 1) ? "were" : "was"), price);
3761 /* Combine / Reorder the pack (later) */
3762 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
3765 p_ptr->window |= (PW_INVEN);
3776 * Recharge rods, wands and staves
3778 * The player can select the number of charges to add
3779 * (up to a limit), and the recharge never fails.
3781 * The cost for rods depends on the level of the rod. The prices
3782 * for recharging wands and staves are dependent on the cost of
3785 static void building_recharge_all(void)
3795 /* Display some info */
3799 prt(" ºÆ½¼Å¶¤ÎÈñÍѤϥ¢¥¤¥Æ¥à¤Î¼ïÎà¤Ë¤è¤ê¤Þ¤¹¡£", 6, 0);
3801 prt(" The prices of recharge depend on the type.", 6, 0);
3804 /* Calculate cost */
3805 for ( i = 0; i < INVEN_PACK; i++)
3807 o_ptr = &inventory[i];
3809 /* skip non magic device */
3810 if (o_ptr->tval < TV_STAFF || o_ptr->tval > TV_ROD) continue;
3812 /* need identified */
3813 if (!object_known_p(o_ptr)) total_cost += 50;
3815 /* Extract the object "level" */
3816 lev = get_object_level(o_ptr);
3818 k_ptr = &k_info[o_ptr->k_idx];
3820 switch (o_ptr->tval)
3823 price = (lev * 50 * o_ptr->timeout) / k_ptr->pval;
3827 /* Price per charge ( = double the price paid by shopkeepers for the charge) */
3828 price = (get_object_cost(o_ptr) / 10) * o_ptr->number;
3830 /* Pay at least 10 gold per charge */
3831 price = MAX(10, price);
3834 price = (k_ptr->pval - o_ptr->pval) * price;
3838 /* Price per charge ( = double the price paid by shopkeepers for the charge) */
3839 price = (get_object_cost(o_ptr) / 10);
3841 /* Pay at least 10 gold per charge */
3842 price = MAX(10, price);
3845 price = (o_ptr->number * k_ptr->pval - o_ptr->pval) * price;
3849 /* if price <= 0 then item have enough charge */
3850 if (price > 0) total_cost += price;
3856 msg_print("½¼Å¶¤¹¤ëɬÍפϤ¢¤ê¤Þ¤»¤ó¡£");
3858 msg_print("No need to recharge.");
3865 /* Check if the player has enough money */
3866 if (p_ptr->au < total_cost)
3869 msg_format("¤¹¤Ù¤Æ¤Î¥¢¥¤¥Æ¥à¤òºÆ½¼Å¶¤¹¤ë¤Ë¤Ï¡ð%d ɬÍפǤ¹¡ª", total_cost );
3871 msg_format("You need %d gold to recharge all items!",total_cost);
3879 if (!get_check(format("¤¹¤Ù¤Æ¤Î¥¢¥¤¥Æ¥à¤ò ¡ð%d ¤ÇºÆ½¼Å¶¤·¤Þ¤¹¤«¡©", total_cost))) return;
3881 if (!get_check(format("Recharge all items for %d gold? ", total_cost))) return;
3884 for (i = 0; i < INVEN_PACK; i++)
3886 o_ptr = &inventory[i];
3887 k_ptr = &k_info[o_ptr->k_idx];
3889 /* skip non magic device */
3890 if (o_ptr->tval < TV_STAFF || o_ptr->tval > TV_ROD) continue;
3893 if (!object_known_p(o_ptr)) identify_item(o_ptr);
3896 switch (o_ptr->tval)
3902 if (o_ptr->pval < k_ptr->pval) o_ptr->pval = k_ptr->pval;
3903 /* We no longer think the item is empty */
3904 o_ptr->ident &= ~(IDENT_EMPTY);
3907 if (o_ptr->pval < o_ptr->number * k_ptr->pval)
3908 o_ptr->pval = o_ptr->number * k_ptr->pval;
3909 /* We no longer think the item is empty */
3910 o_ptr->ident &= ~(IDENT_EMPTY);
3917 msg_format("¡ð%d ¤ÇºÆ½¼Å¶¤·¤Þ¤·¤¿¡£", total_cost);
3919 msg_format("You pay %d gold.", total_cost);
3924 /* Combine / Reorder the pack (later) */
3925 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
3928 p_ptr->window |= (PW_INVEN);
3931 p_ptr->au -= total_cost;
3938 bool tele_town(void)
3946 msg_print("¤³¤ÎËâË¡¤ÏÃϾå¤Ç¤·¤«»È¤¨¤Ê¤¤¡ª");
3948 msg_print("This spell can only be used on the surface!");
3953 if (p_ptr->inside_arena || p_ptr->inside_battle)
3956 msg_print("¤³¤ÎËâË¡¤Ï³°¤Ç¤·¤«»È¤¨¤Ê¤¤¡ª");
3958 msg_print("This spell can only be used outside!");
3966 for (i=1;i<max_towns;i++)
3970 if ((i == NO_TOWN) || (i == SECRET_TOWN) || (i == p_ptr->town_num) || !(p_ptr->visit & (1L << (i-1)))) continue;
3972 sprintf(buf,"%c) %-20s", I2A(i-1), town[i].name);
3980 msg_print("¤Þ¤À¹Ô¤±¤ë¤È¤³¤í¤¬¤Ê¤¤¡£");
3982 msg_print("You have not yet visited any town.");
3991 prt("¤É¤³¤Ë¹Ô¤¤Þ¤¹¤«:", 0, 0);
3993 prt("Which town you go: ", 0, 0);
4004 else if ((i < 'a') || (i > ('a'+max_towns-2))) continue;
4005 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;
4009 for (y = 0; y < max_wild_y; y++)
4011 for (x = 0; x < max_wild_x; x++)
4013 if(wilderness[y][x].town == (i-'a'+1))
4015 p_ptr->wilderness_y = y;
4016 p_ptr->wilderness_x = x;
4020 p_ptr->leftbldg = TRUE;
4021 p_ptr->leaving = TRUE;
4023 p_ptr->teleport_town = TRUE;
4030 * Execute a building command
4032 static void bldg_process_command(building_type *bldg, int i)
4034 int bact = bldg->actions[i];
4037 bool set_reward = FALSE;
4040 /* Flush messages XXX XXX XXX */
4045 bcost = bldg->member_costs[i];
4047 bcost = bldg->other_costs[i];
4049 /* action restrictions */
4050 if (((bldg->action_restr[i] == 1) && !is_member(bldg)) ||
4051 ((bldg->action_restr[i] == 2) && !is_owner(bldg)))
4054 msg_print("¤½¤ì¤òÁªÂò¤¹¤ë¸¢Íø¤Ï¤¢¤ê¤Þ¤»¤ó¡ª");
4056 msg_print("You have no right to choose that!");
4061 /* check gold (HACK - Recharge uses variable costs) */
4062 if ((bact != BACT_RECHARGE) &&
4063 (((bldg->member_costs[i] > p_ptr->au) && is_owner(bldg)) ||
4064 ((bldg->other_costs[i] > p_ptr->au) && !is_owner(bldg))))
4067 msg_print("¤ª¶â¤¬Â¤ê¤Þ¤»¤ó¡ª");
4069 msg_print("You do not have the gold!");
4074 if (!bcost) set_reward = TRUE;
4081 case BACT_RESEARCH_ITEM:
4082 paid = identify_fully(FALSE);
4084 case BACT_TOWN_HISTORY:
4087 case BACT_RACE_LEGENDS:
4093 case BACT_KING_LEGENDS:
4094 case BACT_ARENA_LEGENDS:
4096 show_highclass(building_loc);
4099 case BACT_ARENA_RULES:
4103 case BACT_IN_BETWEEN:
4105 case BACT_SPIN_WHEEL:
4106 case BACT_DICE_SLOTS:
4107 case BACT_GAMBLE_RULES:
4114 paid = inn_comm(bact);
4116 case BACT_RESEARCH_MONSTER:
4117 paid = research_mon();
4119 case BACT_COMPARE_WEAPONS:
4120 paid = compare_weapons();
4122 case BACT_ENCHANT_WEAPON:
4123 item_tester_hook = item_tester_hook_melee_weapon;
4124 enchant_item(bcost, 1, 1, 0);
4126 case BACT_ENCHANT_ARMOR:
4127 item_tester_hook = item_tester_hook_armour;
4128 enchant_item(bcost, 0, 0, 1);
4131 building_recharge();
4133 case BACT_RECHARGE_ALL:
4134 building_recharge_all();
4136 case BACT_IDENTS: /* needs work */
4138 if (!get_check("»ý¤Áʪ¤òÁ´¤Æ´ÕÄꤷ¤Æ¤è¤í¤·¤¤¤Ç¤¹¤«¡©")) break;
4140 msg_print(" »ý¤ÁʪÁ´¤Æ¤¬´ÕÄꤵ¤ì¤Þ¤·¤¿¡£");
4142 if (!get_check("Do you pay for identify all your possession? ")) break;
4144 msg_print("Your possessions have been identified.");
4149 case BACT_IDENT_ONE: /* needs work */
4150 paid = ident_spell(FALSE);
4155 case BACT_HEALING: /* needs work */
4164 case BACT_RESTORE: /* needs work */
4165 if (do_res_stat(A_STR)) paid = TRUE;
4166 if (do_res_stat(A_INT)) paid = TRUE;
4167 if (do_res_stat(A_WIS)) paid = TRUE;
4168 if (do_res_stat(A_DEX)) paid = TRUE;
4169 if (do_res_stat(A_CON)) paid = TRUE;
4170 if (do_res_stat(A_CHR)) paid = TRUE;
4172 case BACT_GOLD: /* set timed reward flag */
4173 if (!p_ptr->rewards[BACT_GOLD])
4176 p_ptr->rewards[BACT_GOLD] = TRUE;
4181 msg_print("º£Æü¤Îʬ¤±Á°¤Ï¤¹¤Ç¤Ë»Ùʧ¤Ã¤¿¤¾¡ª");
4183 msg_print("You just had your daily allowance!");
4187 case BACT_ENCHANT_ARROWS:
4188 item_tester_hook = item_tester_hook_ammo;
4189 enchant_item(bcost, 1, 1, 0);
4191 case BACT_ENCHANT_BOW:
4192 item_tester_tval = TV_BOW;
4193 enchant_item(bcost, 1, 1, 0);
4196 if (recall_player(1)) paid = TRUE;
4198 case BACT_TELEPORT_LEVEL:
4205 /* Allocate the "dun" array */
4206 C_MAKE(dun, max_d_idx, s16b);
4211 for(i = 1; i < max_d_idx; i++)
4216 if (!d_info[i].maxdepth) continue;
4217 if (!max_dlv[i]) continue;
4218 if (d_info[i].final_guardian)
4220 if (!r_info[d_info[i].final_guardian].max_num) seiha = TRUE;
4222 else if (max_dlv[i] == d_info[i].maxdepth) seiha = TRUE;
4225 sprintf(buf,"%c) %c%-12s : ºÇÂç %d ³¬", 'a'+num, seiha ? '!' : ' ', d_name + d_info[i].name, max_dlv[i]);
4227 sprintf(buf,"%c) %c%-12s : Max level %d", 'a'+num, seiha ? '!' : ' ', d_name + d_info[i].name, max_dlv[i]);
4229 put_str(buf, 4+num, 5);
4234 prt("¤É¤Î¥À¥ó¥¸¥ç¥ó¤Ë¥Æ¥ì¥Ý¡¼¥È¤·¤Þ¤¹¤«:", 0, 0);
4236 prt("Which dungeon do you teleport?: ", 0, 0);
4244 /* Free the "dun" array */
4245 C_KILL(dun, max_d_idx, s16b);
4250 if (i >= 'a' && i <('a'+num))
4252 select_dungeon = dun[i-'a'];
4259 /* Free the "dun" array */
4260 C_KILL(dun, max_d_idx, s16b);
4262 max_depth = d_info[select_dungeon].maxdepth;
4264 /* Limit depth in Angband */
4265 if (select_dungeon == DUNGEON_ANGBAND)
4267 if (quest[QUEST_OBERON].status != QUEST_STATUS_FINISHED) max_depth = 98;
4268 else if(quest[QUEST_SERPENT].status != QUEST_STATUS_FINISHED) max_depth = 99;
4272 amt = get_quantity(format("%s¤Î²¿³¬¤Ë¥Æ¥ì¥Ý¡¼¥È¤·¤Þ¤¹¤«¡©", d_name + d_info[select_dungeon].name), max_depth);
4274 amt = get_quantity(format("Teleport to which level of %s? ", d_name + d_info[select_dungeon].name), max_depth);
4279 p_ptr->word_recall = 1;
4280 p_ptr->recall_dungeon = select_dungeon;
4281 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));
4282 if (record_maxdeapth)
4284 do_cmd_write_nikki(NIKKI_TRUMP, select_dungeon, "¥È¥é¥ó¥×¥¿¥ï¡¼¤Ç");
4286 do_cmd_write_nikki(NIKKI_TRUMP, select_dungeon, "at Trump Tower");
4289 msg_print("²ó¤ê¤ÎÂ絤¤¬Ä¥¤ê¤Ä¤á¤Æ¤¤¿...");
4291 msg_print("The air about you becomes charged...");
4295 p_ptr->redraw |= (PR_STATUS);
4299 case BACT_LOSE_MUTATION:
4300 paid = lose_mutation(0);
4301 /* ToDo: Better message text. */
4304 msg_print("´ñ̯¤Ê¤¯¤é¤¤ÉáÄ̤ˤʤ俵¤¤¬¤¹¤ë¡£");
4306 msg_print("You feel oddly normal.");
4314 case BACT_TSUCHINOKO:
4328 msg_print("Ê¿¹Õ²½¤Îµ·¼°¤ò¹Ô¤Ê¤Ã¤¿¡£");
4330 msg_print("You received an equalization ritual.");
4332 set_virtue(V_COMPASSION, 0);
4333 set_virtue(V_HONOUR, 0);
4334 set_virtue(V_JUSTICE, 0);
4335 set_virtue(V_SACRIFICE, 0);
4336 set_virtue(V_KNOWLEDGE, 0);
4337 set_virtue(V_FAITH, 0);
4338 set_virtue(V_ENLIGHTEN, 0);
4339 set_virtue(V_ENCHANT, 0);
4340 set_virtue(V_CHANCE, 0);
4341 set_virtue(V_NATURE, 0);
4342 set_virtue(V_HARMONY, 0);
4343 set_virtue(V_VITALITY, 0);
4344 set_virtue(V_UNLIFE, 0);
4345 set_virtue(V_PATIENCE, 0);
4346 set_virtue(V_TEMPERANCE, 0);
4347 set_virtue(V_DILIGENCE, 0);
4348 set_virtue(V_VALOUR, 0);
4349 set_virtue(V_INDIVIDUALISM, 0);
4353 case BACT_TELE_TOWN:
4368 void do_cmd_quest(void)
4372 if (cave[py][px].feat != FEAT_QUEST_ENTER)
4375 msg_print("¤³¤³¤Ë¤Ï¥¯¥¨¥¹¥È¤ÎÆþ¸ý¤Ï¤Ê¤¤¡£");
4377 msg_print("You see no quest level here.");
4385 msg_print("¤³¤³¤Ë¤Ï¥¯¥¨¥¹¥È¤Ø¤ÎÆþ¸ý¤¬¤¢¤ê¤Þ¤¹¡£");
4386 if (!get_check("¥¯¥¨¥¹¥È¤ËÆþ¤ê¤Þ¤¹¤«¡©")) return;
4387 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
4388 msg_print("¡Ø¤È¤Ë¤«¤¯Æþ¤Ã¤Æ¤ß¤è¤¦¤¼¤§¡£¡Ù");
4390 msg_print("There is an entry of a quest.");
4391 if (!get_check("Do you enter? ")) return;
4394 /* Player enters a new quest */
4398 leaving_quest = p_ptr->inside_quest;
4400 /* Leaving an 'only once' quest marks it as failed */
4401 if (leaving_quest &&
4402 ((quest[leaving_quest].flags & QUEST_FLAG_ONCE) || (quest[leaving_quest].type == QUEST_TYPE_RANDOM)) &&
4403 (quest[leaving_quest].status == QUEST_STATUS_TAKEN))
4405 quest[leaving_quest].status = QUEST_STATUS_FAILED;
4406 quest[leaving_quest].complev = (byte)p_ptr->lev;
4407 if (quest[leaving_quest].type == QUEST_TYPE_RANDOM)
4409 r_info[quest[leaving_quest].r_idx].flags1 &= ~(RF1_QUESTOR);
4410 do_cmd_write_nikki(NIKKI_RAND_QUEST_F, leaving_quest, NULL);
4412 else if (record_fix_quest)
4413 do_cmd_write_nikki(NIKKI_FIX_QUEST_F, leaving_quest, NULL);
4416 p_ptr->inside_quest = cave[py][px].special;
4417 if(quest[leaving_quest].type != QUEST_TYPE_RANDOM) dun_level = 1;
4418 p_ptr->leftbldg = TRUE;
4419 p_ptr->leaving = TRUE;
4425 * Do building commands
4427 void do_cmd_bldg(void)
4432 building_type *bldg;
4437 if (!((cave[py][px].feat >= FEAT_BLDG_HEAD) &&
4438 (cave[py][px].feat <= FEAT_BLDG_TAIL)))
4441 msg_print("¤³¤³¤Ë¤Ï·úʪ¤Ï¤Ê¤¤¡£");
4443 msg_print("You see no building here.");
4449 which = (cave[py][px].feat - FEAT_BLDG_HEAD);
4450 building_loc = which;
4452 bldg = &building[which];
4454 /* Don't re-init the wilderness */
4455 reinit_wilderness = FALSE;
4457 if ((which == 2) && (p_ptr->arena_number == 99))
4460 msg_print("¡ÖÇÔ¼Ô¤ËÍѤϤʤ¤¡£¡×");
4462 msg_print("'There is no place for LOSER.'");
4466 else if ((which == 2) && p_ptr->inside_arena && !p_ptr->exit_bldg)
4469 prt("¥²¡¼¥È¤ÏÊĤޤäƤ¤¤ë¡£¥â¥ó¥¹¥¿¡¼¤¬¤¢¤Ê¤¿¤òÂԤäƤ¤¤ë¡ª",0,0);
4471 prt("The gates are closed. The monster awaits!", 0, 0);
4476 else if ((which == 2) && p_ptr->inside_arena)
4478 p_ptr->leaving = TRUE;
4479 p_ptr->inside_arena = FALSE;
4481 else if (p_ptr->inside_battle)
4483 p_ptr->leaving = TRUE;
4484 p_ptr->inside_battle = FALSE;
4492 /* Forget the lite */
4495 /* Forget the view */
4498 /* Hack -- Increase "icky" depth */
4505 show_building(bldg);
4513 building_prt_gold();
4517 if (command == ESCAPE)
4520 p_ptr->inside_arena = FALSE;
4521 p_ptr->inside_battle = FALSE;
4525 for (i = 0; i < 8; i++)
4527 if (bldg->letters[i])
4529 if (bldg->letters[i] == command)
4538 bldg_process_command(bldg, i);
4547 /* Flush messages XXX XXX XXX */
4551 /* Reinit wilderness to activate quests ... */
4552 if (reinit_wilderness)
4553 p_ptr->leaving = TRUE;
4555 /* Hack -- Decrease "icky" depth */
4558 /* Clear the screen */
4561 /* Update the visuals */
4562 p_ptr->update |= (PU_VIEW | PU_MONSTERS | PU_BONUS | PU_LITE | PU_MON_LITE);
4564 /* Redraw entire screen */
4565 p_ptr->redraw |= (PR_BASIC | PR_EXTRA | PR_EQUIPPY | PR_MAP);
4568 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
4572 /* Array of places to find an inscription */
4573 static cptr find_quest[] =
4576 "¾²¤Ë¥á¥Ã¥»¡¼¥¸¤¬¹ï¤Þ¤ì¤Æ¤¤¤ë:",
4578 "You find the following inscription in the floor",
4582 "Êɤ˥á¥Ã¥»¡¼¥¸¤¬¹ï¤Þ¤ì¤Æ¤¤¤ë:",
4584 "You see a message inscribed in the wall",
4588 "¥á¥Ã¥»¡¼¥¸¤ò¸«¤Ä¤±¤¿:",
4590 "There is a sign saying",
4594 "²¿¤«¤¬³¬Ãʤξå¤Ë½ñ¤¤¤Æ¤¢¤ë:",
4596 "Something is written on the staircase",
4600 "´¬Êª¤ò¸«¤Ä¤±¤¿¡£¥á¥Ã¥»¡¼¥¸¤¬½ñ¤¤¤Æ¤¢¤ë:",
4602 "You find a scroll with the following message",
4611 void quest_discovery(int q_idx)
4613 quest_type *q_ptr = &quest[q_idx];
4614 monster_race *r_ptr = &r_info[q_ptr->r_idx];
4615 int q_num = q_ptr->max_num;
4618 /* No quest index */
4621 strcpy(name, (r_name + r_ptr->name));
4623 msg_print(find_quest[rand_range(0, 4)]);
4630 msg_format("Ãí°Õ¤»¤è¡ª¤³¤Î³¬¤Ï%s¤Ë¤è¤Ã¤Æ¼é¤é¤ì¤Æ¤¤¤ë¡ª", name);
4632 msg_format("Beware, this level is protected by %s!", name);
4638 /* Normal monsters */
4640 msg_format("Ãí°Õ¤·¤í¡ª¤³¤Î³¬¤Ï%dÂΤÎ%s¤Ë¤è¤Ã¤Æ¼é¤é¤ì¤Æ¤¤¤ë¡ª", q_num, name);
4643 msg_format("Be warned, this level is guarded by %d %s!", q_num, name);
4651 * Hack -- Check if a level is a "quest" level
4653 int quest_number(int level)
4658 if (p_ptr->inside_quest)
4659 return (p_ptr->inside_quest);
4661 for (i = 0; i < max_quests; i++)
4663 if (quest[i].status != QUEST_STATUS_TAKEN) continue;
4665 if ((quest[i].type == QUEST_TYPE_KILL_LEVEL) &&
4666 !(quest[i].flags & QUEST_FLAG_PRESET) &&
4667 (quest[i].level == level) &&
4668 (quest[i].dungeon == dungeon_type))
4672 /* Check for random quest */
4673 return (random_quest_number(level));
4678 * Return the index of the random quest on this level
4681 int random_quest_number(int level)
4685 if (dungeon_type != DUNGEON_ANGBAND) return 0;
4687 for (i = MIN_RANDOM_QUEST; i < MAX_RANDOM_QUEST + 1; i++)
4689 if ((quest[i].type == QUEST_TYPE_RANDOM) &&
4690 (quest[i].status == QUEST_STATUS_TAKEN) &&
4691 (quest[i].level == level) &&
4692 (quest[i].dungeon == DUNGEON_ANGBAND))