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 is_owner(building_type *bldg)
24 if (bldg->member_class[p_ptr->pclass] == BUILDING_OWNER)
29 if (bldg->member_race[p_ptr->prace] == BUILDING_OWNER)
34 if ((is_magic(p_ptr->realm1) && (bldg->member_realm[p_ptr->realm1] == BUILDING_OWNER)) ||
35 (is_magic(p_ptr->realm2) && (bldg->member_realm[p_ptr->realm2] == BUILDING_OWNER)))
44 static bool is_member(building_type *bldg)
46 if (bldg->member_class[p_ptr->pclass])
51 if (bldg->member_race[p_ptr->prace])
56 if ((is_magic(p_ptr->realm1) && bldg->member_realm[p_ptr->realm1]) ||
57 (is_magic(p_ptr->realm2) && bldg->member_realm[p_ptr->realm2]))
63 if (p_ptr->pclass == CLASS_SORCERER)
67 for (i = 0; i < MAX_MAGIC; i++)
69 if (bldg->member_realm[i+1]) OK = TRUE;
78 * Clear the building information
80 static void clear_bldg(int min_row, int max_row)
84 for (i = min_row; i <= max_row; i++)
88 static void building_prt_gold(void)
93 prt("¼ê»ý¤Á¤Î¤ª¶â: ", 23,53);
95 prt("Gold Remaining: ", 23, 53);
99 sprintf(tmp_str, "%9ld", (long)p_ptr->au);
100 prt(tmp_str, 23, 68);
105 * Display a building.
107 static void show_building(building_type* bldg)
115 sprintf(tmp_str, "%s (%s) %35s", bldg->owner_name, bldg->owner_race, bldg->name);
119 for (i = 0; i < 8; i++)
121 if (bldg->letters[i])
123 if (bldg->action_restr[i] == 0)
125 if ((is_owner(bldg) && (bldg->member_costs[i] == 0)) ||
126 (!is_owner(bldg) && (bldg->other_costs[i] == 0)))
128 action_color = TERM_WHITE;
131 else if (is_owner(bldg))
133 action_color = TERM_YELLOW;
135 sprintf(buff, "($%ld)", bldg->member_costs[i]);
137 sprintf(buff, "(%ldgp)", bldg->member_costs[i]);
143 action_color = TERM_YELLOW;
145 sprintf(buff, "($%ld)", bldg->other_costs[i]);
147 sprintf(buff, "(%ldgp)", bldg->other_costs[i]);
152 else if (bldg->action_restr[i] == 1)
154 if (!is_member(bldg))
156 action_color = TERM_L_DARK;
158 strcpy(buff, "(ÊÄŹ)");
160 strcpy(buff, "(closed)");
164 else if ((is_owner(bldg) && (bldg->member_costs[i] == 0)) ||
165 (is_member(bldg) && (bldg->other_costs[i] == 0)))
167 action_color = TERM_WHITE;
170 else if (is_owner(bldg))
172 action_color = TERM_YELLOW;
174 sprintf(buff, "($%ld)", bldg->member_costs[i]);
176 sprintf(buff, "(%ldgp)", bldg->member_costs[i]);
182 action_color = TERM_YELLOW;
184 sprintf(buff, "($%ld)", bldg->other_costs[i]);
186 sprintf(buff, "(%ldgp)", bldg->other_costs[i]);
195 action_color = TERM_L_DARK;
197 strcpy(buff, "(ÊÄŹ)");
199 strcpy(buff, "(closed)");
203 else if (bldg->member_costs[i] != 0)
205 action_color = TERM_YELLOW;
207 sprintf(buff, "($%ld)", bldg->member_costs[i]);
209 sprintf(buff, "(%ldgp)", bldg->member_costs[i]);
215 action_color = TERM_WHITE;
220 sprintf(tmp_str," %c) %s %s", bldg->letters[i], bldg->act_names[i], buff);
221 c_put_str(action_color, tmp_str, 19+(i/2), 35*(i%2));
226 prt(" ESC) ·úʪ¤ò½Ð¤ë", 23, 0);
228 prt(" ESC) Exit building", 23, 0);
237 static void arena_comm(int cmd)
246 if (p_ptr->arena_number == MAX_ARENA_MONS)
250 prt("¥¢¥ê¡¼¥Ê¤ÎÍ¥¾¡¼Ô¡ª", 5, 0);
251 prt("¤ª¤á¤Ç¤È¤¦¡ª¤¢¤Ê¤¿¤ÏÁ´¤Æ¤ÎŨ¤òÅݤ·¤Þ¤·¤¿¡£", 7, 0);
252 prt("¾Þ¶â¤È¤·¤Æ $1,000,000 ¤¬Í¿¤¨¤é¤ì¤Þ¤¹¡£", 8, 0);
254 prt(" Arena Victor!", 5, 0);
255 prt("Congratulations! You have defeated all before you.", 7, 0);
256 prt("For that, receive the prize: 1,000,000 gold pieces", 8, 0);
261 p_ptr->au += 1000000L;
263 msg_print("¥¹¥Ú¡¼¥¹¥¡¼¤Ç³¹Ô");
265 msg_print("Press the space bar to continue");
269 p_ptr->arena_number++;
271 else if (p_ptr->arena_number > MAX_ARENA_MONS)
273 if (p_ptr->arena_number < MAX_ARENA_MONS+2)
276 msg_print("·¯¤Î¤¿¤á¤ËºÇ¶¯¤ÎÄ©Àï¼Ô¤òÍÑ°Õ¤·¤Æ¤ª¤¤¤¿¡£");
278 msg_print("The strongest challenger is waiting for you.");
283 if (get_check("Ä©À魯¤ë¤«¤Í¡©"))
285 if (get_check("Do you fight? "))
288 p_ptr->leftbldg = TRUE;
289 p_ptr->inside_arena = TRUE;
290 p_ptr->exit_bldg = FALSE;
292 p_ptr->leaving = TRUE;
298 msg_print("»ÄÇ°¤À¡£");
300 msg_print("We are disappointed.");
307 msg_print("¤¢¤Ê¤¿¤Ï¥¢¥ê¡¼¥Ê¤ËÆþ¤ê¡¢¤·¤Ð¤é¤¯¤Î´Ö±É¸÷¤Ë¤Ò¤¿¤Ã¤¿¡£");
309 msg_print("You enter the arena briefly and bask in your glory.");
315 else if (p_ptr->riding && (p_ptr->pclass != CLASS_BEASTMASTER) && (p_ptr->pclass != CLASS_CAVALRY))
318 msg_print("¥Ú¥Ã¥È¤Ë¾è¤Ã¤¿¤Þ¤Þ¤Ç¤Ï¥¢¥ê¡¼¥Ê¤ØÆþ¤ì¤µ¤»¤Æ¤â¤é¤¨¤Ê¤«¤Ã¤¿¡£");
320 msg_print("You don't have permission to enter with pet.");
327 p_ptr->leftbldg = TRUE;
328 p_ptr->inside_arena = TRUE;
329 p_ptr->exit_bldg = FALSE;
331 p_ptr->leaving = TRUE;
336 if (p_ptr->arena_number == MAX_ARENA_MONS)
338 msg_print("¤¢¤Ê¤¿¤Ï¾¡Íø¼Ô¤À¡£ ¥¢¥ê¡¼¥Ê¤Ç¤Î¥»¥ì¥â¥Ë¡¼¤Ë»²²Ã¤·¤Ê¤µ¤¤¡£");
340 msg_print("You are victorious. Enter the arena for the ceremony.");
343 else if (p_ptr->arena_number > MAX_ARENA_MONS)
346 msg_print("¤¢¤Ê¤¿¤Ï¤¹¤Ù¤Æ¤ÎŨ¤Ë¾¡Íø¤·¤¿¡£");
348 msg_print("You have won against all foes.");
353 r_ptr = &r_info[arena_info[p_ptr->arena_number].r_idx];
354 name = (r_name + r_ptr->name);
356 msg_format("%s ¤ËÄ©À魯¤ë¤â¤Î¤Ï¤¤¤Ê¤¤¤«¡©", name);
358 msg_format("Do I hear any challenges against: %s", name);
362 case BACT_ARENA_RULES:
367 /* Peruse the arena help file */
369 (void)show_file(TRUE, "arena_j.txt", NULL, 0, 0);
371 (void)show_file(TRUE, "arena.txt", NULL, 0, 0);
384 * display fruit for dice slots
386 static void display_fruit(int row, int col, int fruit)
392 c_put_str(TERM_YELLOW, " ####.", row, col);
393 c_put_str(TERM_YELLOW, " # #", row + 1, col);
394 c_put_str(TERM_YELLOW, " # #", row + 2, col);
395 c_put_str(TERM_YELLOW, "# #", row + 3, col);
396 c_put_str(TERM_YELLOW, "# #", row + 4, col);
397 c_put_str(TERM_YELLOW, "# # ", row + 5, col);
398 c_put_str(TERM_YELLOW, "# # ", row + 6, col);
399 c_put_str(TERM_YELLOW, ".#### ", row + 7, col);
400 prt( " ¥ì¥â¥ó ", row + 8, col);
402 c_put_str(TERM_YELLOW, " ####.", row, col);
403 c_put_str(TERM_YELLOW, " # #", row + 1, col);
404 c_put_str(TERM_YELLOW, " # #", row + 2, col);
405 c_put_str(TERM_YELLOW, "# #", row + 3, col);
406 c_put_str(TERM_YELLOW, "# #", row + 4, col);
407 c_put_str(TERM_YELLOW, "# # ", row + 5, col);
408 c_put_str(TERM_YELLOW, "# # ", row + 6, col);
409 c_put_str(TERM_YELLOW, ".#### ", row + 7, col);
410 prt( " Lemon ", row + 8, col);
416 c_put_str(TERM_ORANGE, " ## ", row, col);
417 c_put_str(TERM_ORANGE, " #..# ", row + 1, col);
418 c_put_str(TERM_ORANGE, " #....# ", row + 2, col);
419 c_put_str(TERM_ORANGE, "#......#", row + 3, col);
420 c_put_str(TERM_ORANGE, "#......#", row + 4, col);
421 c_put_str(TERM_ORANGE, " #....# ", row + 5, col);
422 c_put_str(TERM_ORANGE, " #..# ", row + 6, col);
423 c_put_str(TERM_ORANGE, " ## ", row + 7, col);
424 prt( "¥ª¥ì¥ó¥¸", row + 8, col);
426 c_put_str(TERM_ORANGE, " ## ", row, col);
427 c_put_str(TERM_ORANGE, " #..# ", row + 1, col);
428 c_put_str(TERM_ORANGE, " #....# ", row + 2, col);
429 c_put_str(TERM_ORANGE, "#......#", row + 3, col);
430 c_put_str(TERM_ORANGE, "#......#", row + 4, col);
431 c_put_str(TERM_ORANGE, " #....# ", row + 5, col);
432 c_put_str(TERM_ORANGE, " #..# ", row + 6, col);
433 c_put_str(TERM_ORANGE, " ## ", row + 7, col);
434 prt( " Orange ", row + 8, col);
440 c_put_str(TERM_SLATE, " ¦« " , row, col);
441 c_put_str(TERM_SLATE, " || " , row + 1, col);
442 c_put_str(TERM_SLATE, " || " , row + 2, col);
443 c_put_str(TERM_SLATE, " || " , row + 3, col);
444 c_put_str(TERM_SLATE, " || " , row + 4, col);
445 c_put_str(TERM_SLATE, " || " , row + 5, col);
446 c_put_str(TERM_UMBER, " |=°¡=| " , row + 6, col);
447 c_put_str(TERM_UMBER, " ÌÜ " , row + 7, col);
448 prt( " ·õ " , row + 8, col);
450 c_put_str(TERM_SLATE, " /\\ " , row, col);
451 c_put_str(TERM_SLATE, " ## " , row + 1, col);
452 c_put_str(TERM_SLATE, " ## " , row + 2, col);
453 c_put_str(TERM_SLATE, " ## " , row + 3, col);
454 c_put_str(TERM_SLATE, " ## " , row + 4, col);
455 c_put_str(TERM_SLATE, " ## " , row + 5, col);
456 c_put_str(TERM_UMBER, " ###### " , row + 6, col);
457 c_put_str(TERM_UMBER, " ## " , row + 7, col);
458 prt( " Sword " , row + 8, col);
464 c_put_str(TERM_SLATE, " ###### ", row, col);
465 c_put_str(TERM_SLATE, "# #", row + 1, col);
466 c_put_str(TERM_SLATE, "# ++++ #", row + 2, col);
467 c_put_str(TERM_SLATE, "# +==+ #", row + 3, col);
468 c_put_str(TERM_SLATE, "# ++ #", row + 4, col);
469 c_put_str(TERM_SLATE, " # # ", row + 5, col);
470 c_put_str(TERM_SLATE, " # # ", row + 6, col);
471 c_put_str(TERM_SLATE, " ## ", row + 7, col);
472 prt( " ½â ", row + 8, col);
474 c_put_str(TERM_SLATE, " ###### ", row, col);
475 c_put_str(TERM_SLATE, "# #", row + 1, col);
476 c_put_str(TERM_SLATE, "# ++++ #", row + 2, col);
477 c_put_str(TERM_SLATE, "# +==+ #", row + 3, col);
478 c_put_str(TERM_SLATE, "# ++ #", row + 4, col);
479 c_put_str(TERM_SLATE, " # # ", row + 5, col);
480 c_put_str(TERM_SLATE, " # # ", row + 6, col);
481 c_put_str(TERM_SLATE, " ## ", row + 7, col);
482 prt( " Shield ", row + 8, col);
488 c_put_str(TERM_VIOLET, " ## ", row, col);
489 c_put_str(TERM_VIOLET, " ###### ", row + 1, col);
490 c_put_str(TERM_VIOLET, "########", row + 2, col);
491 c_put_str(TERM_VIOLET, "########", row + 3, col);
492 c_put_str(TERM_VIOLET, "########", row + 4, col);
493 c_put_str(TERM_VIOLET, " ###### ", row + 5, col);
494 c_put_str(TERM_VIOLET, " #### ", row + 6, col);
495 c_put_str(TERM_VIOLET, " ## ", row + 7, col);
496 prt( " ¥×¥é¥à ", row + 8, col);
498 c_put_str(TERM_VIOLET, " ## ", row, col);
499 c_put_str(TERM_VIOLET, " ###### ", row + 1, col);
500 c_put_str(TERM_VIOLET, "########", row + 2, col);
501 c_put_str(TERM_VIOLET, "########", row + 3, col);
502 c_put_str(TERM_VIOLET, "########", row + 4, col);
503 c_put_str(TERM_VIOLET, " ###### ", row + 5, col);
504 c_put_str(TERM_VIOLET, " #### ", row + 6, col);
505 c_put_str(TERM_VIOLET, " ## ", row + 7, col);
506 prt( " Plum ", row + 8, col);
512 c_put_str(TERM_RED, " ##", row, col);
513 c_put_str(TERM_RED, " ### ", row + 1, col);
514 c_put_str(TERM_RED, " #..# ", row + 2, col);
515 c_put_str(TERM_RED, " #..# ", row + 3, col);
516 c_put_str(TERM_RED, " ###### ", row + 4, col);
517 c_put_str(TERM_RED, "#..##..#", row + 5, col);
518 c_put_str(TERM_RED, "#..##..#", row + 6, col);
519 c_put_str(TERM_RED, " ## ## ", row + 7, col);
520 prt( "¥Á¥§¥ê¡¼", row + 8, col);
522 c_put_str(TERM_RED, " ##", row, col);
523 c_put_str(TERM_RED, " ### ", row + 1, col);
524 c_put_str(TERM_RED, " #..# ", row + 2, col);
525 c_put_str(TERM_RED, " #..# ", row + 3, col);
526 c_put_str(TERM_RED, " ###### ", row + 4, col);
527 c_put_str(TERM_RED, "#..##..#", row + 5, col);
528 c_put_str(TERM_RED, "#..##..#", row + 6, col);
529 c_put_str(TERM_RED, " ## ## ", row + 7, col);
530 prt( " Cherry ", row + 8, col);
538 * kpoker no (tyuto-hannpa na)pakuri desu...
539 * joker ha shineru node haitte masen.
541 * TODO: donataka! tsukutte!
542 * - agatta yaku no kiroku (like DQ).
543 * - kakkoii card no e.
544 * - sousa-sei no koujyo.
545 * - code wo wakariyasuku.
547 * - Joker... -- done.
550 * 9/15/2000 joker wo jissou. soreto, code wo sukosi kakikae. --Habu
552 #define SUIT_OF(card) ((card) / 13)
553 #define NUM_OF(card) ((card) % 13)
554 #define IS_JOKER(card) ((card) == 52)
556 static int cards[5]; /* tefuda no card */
558 static void reset_deck(int deck[])
561 for (i = 0; i < 53; i++) deck[i] = i;
564 for (i = 0; i < 53; i++){
565 int tmp1 = randint0(53 - i) + i;
567 deck[i] = deck[tmp1];
572 static bool have_joker(void)
576 for (i = 0; i < 5; i++){
577 if(IS_JOKER(cards[i])) return TRUE;
582 static bool find_card_num(int num)
585 for (i = 0; i < 5; i++)
586 if (NUM_OF(cards[i]) == num && !IS_JOKER(cards[i])) return TRUE;
590 static bool yaku_check_flush(void)
593 bool joker_is_used = FALSE;
595 suit = IS_JOKER(cards[0]) ? SUIT_OF(cards[1]) : SUIT_OF(cards[0]);
596 for (i = 0; i < 5; i++){
597 if (SUIT_OF(cards[i]) != suit){
598 if(have_joker() && !joker_is_used)
599 joker_is_used = TRUE;
608 static int yaku_check_straight(void)
611 bool joker_is_used = FALSE;
614 for (i = 0; i < 5; i++)
616 if (NUM_OF(cards[i]) < lowest && !IS_JOKER(cards[i]))
617 lowest = NUM_OF(cards[i]);
620 if (yaku_check_flush())
623 for (i = 0; i < 4; i++)
625 if (!find_card_num(9 + i)){
626 if( have_joker() && !joker_is_used )
627 joker_is_used = TRUE;
632 if (i == 4) return 3; /* Wow! Royal Flush!!! */
635 for (i = 0; i < 3; i++)
637 if (!find_card_num(10 + i))
640 if (i == 3 && have_joker()) return 3; /* Wow! Royal Flush!!! */
644 joker_is_used = FALSE;
645 for (i = 0; i < 5; i++)
647 if (!find_card_num(lowest + i)){
648 if( have_joker() && !joker_is_used )
649 joker_is_used = TRUE;
655 if (yaku_check_flush())
656 return 2; /* Straight Flush */
662 * 0:nopair 1:1 pair 2:2 pair 3:3 cards 4:full house 6:4cards
664 static int yaku_check_pair(void)
666 int i, i2, matching = 0;
668 for (i = 0; i < 5; i++)
670 for (i2 = i+1; i2 < 5; i2++)
672 if (IS_JOKER(cards[i]) || IS_JOKER(cards[i2])) continue;
673 if (NUM_OF(cards[i]) == NUM_OF(cards[i2]))
715 static int yaku_check(void)
719 switch(yaku_check_straight()){
722 c_put_str(TERM_YELLOW, "¥í¥¤¥ä¥ë¥¹¥È¥ì¡¼¥È¥Õ¥é¥Ã¥·¥å", 4, 3);
724 c_put_str(TERM_YELLOW, "Royal Flush", 4, 3);
729 c_put_str(TERM_YELLOW, "¥¹¥È¥ì¡¼¥È¥Õ¥é¥Ã¥·¥å", 4, 3);
731 c_put_str(TERM_YELLOW, "Straight Flush", 4, 3);
736 c_put_str(TERM_YELLOW, "¥¹¥È¥ì¡¼¥È", 4, 3);
738 c_put_str(TERM_YELLOW, "Straight", 4, 3);
742 /* Not straight -- fall through */
746 if (yaku_check_flush())
750 c_put_str(TERM_YELLOW, "¥Õ¥é¥Ã¥·¥å", 4, 3);
752 c_put_str(TERM_YELLOW, "Flush", 4, 3);
757 switch (yaku_check_pair())
761 c_put_str(TERM_YELLOW, "¥ï¥ó¥Ú¥¢", 4, 3);
763 c_put_str(TERM_YELLOW, "One pair", 4, 3);
768 c_put_str(TERM_YELLOW, "¥Ä¡¼¥Ú¥¢", 4, 3);
770 c_put_str(TERM_YELLOW, "Two pair", 4, 3);
775 c_put_str(TERM_YELLOW, "¥¹¥ê¡¼¥«¡¼¥É", 4, 3);
777 c_put_str(TERM_YELLOW, "Three of a kind", 4, 3);
782 c_put_str(TERM_YELLOW, "¥Õ¥ë¥Ï¥¦¥¹", 4, 3);
784 c_put_str(TERM_YELLOW, "Full house", 4, 3);
789 c_put_str(TERM_YELLOW, "¥Õ¥©¡¼¥«¡¼¥É", 4, 3);
791 c_put_str(TERM_YELLOW, "Four of a kind", 4, 3);
795 if (!NUM_OF(cards[0]) || !NUM_OF(cards[1]))
798 c_put_str(TERM_YELLOW, "¥Õ¥¡¥¤¥Ö¥¨¡¼¥¹", 4, 3);
800 c_put_str(TERM_YELLOW, "Five ace", 4, 3);
807 c_put_str(TERM_YELLOW, "¥Õ¥¡¥¤¥Ö¥«¡¼¥É", 4, 3);
809 c_put_str(TERM_YELLOW, "Five of a kind", 4, 3);
819 static void display_kaeruka(int hoge, int kaeruka[])
822 char col = TERM_WHITE;
823 for (i = 0; i < 5; i++)
825 if (i == hoge) col = TERM_YELLOW;
826 else if(kaeruka[i]) col = TERM_WHITE;
827 else col = TERM_L_BLUE;
830 c_put_str(col, "¤«¤¨¤ë", 14, 5+i*16);
832 c_put_str(col, "¤Î¤³¤¹", 14, 5+i*16);
835 c_put_str(col, "Change", 14, 5+i*16);
837 c_put_str(col, " Stay ", 14, 5+i*16);
840 if (hoge > 4) col = TERM_YELLOW;
841 else col = TERM_WHITE;
843 c_put_str(col, "·èÄê", 16, 38);
845 c_put_str(col, "Sure", 16, 38);
848 /* Hilite current option */
849 if (hoge < 5) move_cursor(14, 5+hoge*16);
850 else move_cursor(16, 38);
854 static void display_cards(void)
857 char suitcolor[4] = {TERM_YELLOW, TERM_L_RED, TERM_L_BLUE, TERM_L_GREEN};
859 cptr suit[4] = {"¡ú", "¡ü", "¢ù", "¢÷"};
860 cptr card_grph[13][7] = {{"£Á %s ",
951 cptr joker_grph[7] = { " ",
961 cptr suit[4] = {"[]", "qp", "<>", "db"};
962 cptr card_grph[13][7] = {{"A %s ",
1053 cptr joker_grph[7] = { " ",
1062 for (i = 0; i < 5; i++)
1065 prt("¨®¨¬¨¬¨¬¨¬¨¬¨¬¨¯", 5, i*16);
1067 prt(" +------------+ ", 5, i*16);
1071 for (i = 0; i < 5; i++)
1073 for (j = 0; j < 7; j++)
1076 prt("¨", j+6, i*16);
1078 prt(" |", j+6, i*16);
1080 if(IS_JOKER(cards[i]))
1081 c_put_str(TERM_VIOLET, joker_grph[j], j+6, 2+i*16);
1083 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);
1085 prt("¨", j+6, i*16+14);
1087 prt("| ", j+6, i*16+14);
1091 for (i = 0; i < 5; i++)
1094 prt("¨±¨¬¨¬¨¬¨¬¨¬¨¬¨°", 13, i*16);
1096 prt(" +------------+ ", 13, i*16);
1101 static int do_poker(void)
1105 int deck[53]; /* yamafuda : 0...52 */
1107 int kaeruka[5]; /* 0:kaenai 1:kaeru */
1111 bool kakikae = TRUE;
1115 for (i = 0; i < 5; i++)
1117 cards[i] = deck[deck_ptr++];
1118 kaeruka[i] = 0; /* default:nokosu */
1138 /* debug:Four Cards */
1140 cards[1] = 0 + 13 * 1;
1141 cards[2] = 0 + 13 * 2;
1142 cards[3] = 0 + 13 * 3;
1146 /* debug:Straight */
1162 /* suteruno wo kimeru */
1164 prt("»Ä¤¹¥«¡¼¥É¤ò·è¤á¤Æ²¼¤µ¤¤(Êý¸þ¤Ç°ÜÆ°, ¥¹¥Ú¡¼¥¹¤ÇÁªÂò)¡£", 0, 0);
1166 prt("Stay witch? ", 0, 0);
1174 if (kakikae) display_kaeruka(k+kettei*5, kaeruka);
1179 case '6': case 'l': case 'L': case KTRL('F'):
1180 if (!kettei) k = (k+1)%5;
1181 else {k = 0;kettei = FALSE;}
1184 case '4': case 'h': case 'H': case KTRL('B'):
1185 if (!kettei) k = (k+4)%5;
1186 else {k = 4;kettei = FALSE;}
1189 case '2': case 'j': case 'J': case KTRL('N'):
1190 if (!kettei) {kettei = TRUE;kakikae = TRUE;}
1192 case '8': case 'k': case 'K': case KTRL('P'):
1193 if (kettei) {kettei = FALSE;kakikae = TRUE;}
1195 case ' ': case '\r':
1196 if (kettei) done = TRUE;
1197 else {kaeruka[k] = !kaeruka[k];kakikae = TRUE;}
1206 for (i = 0; i < 5; i++)
1207 if (kaeruka[i] == 1) cards[i] = deck[deck_ptr++]; /* soshite toru */
1211 return yaku_check();
1216 /* end of poker codes --Koka */
1221 static bool gamble_comm(int cmd)
1224 int roll1, roll2, roll3, choice, odds, win;
1229 char out_val[160], tmp_str[80], again;
1234 if (cmd == BACT_GAMBLE_RULES)
1236 /* Peruse the gambling help file */
1238 (void)show_file(TRUE, "jgambling.txt", NULL, 0, 0);
1240 (void)show_file(TRUE, "gambling.txt", NULL, 0, 0);
1250 msg_print("¤ª¤¤¡ª¤ª¤Þ¤¨°ìʸ¤Ê¤·¤¸¤ã¤Ê¤¤¤«¡ª¤³¤Ã¤«¤é½Ð¤Æ¤¤¤±¡ª");
1252 msg_print("Hey! You don't have gold - get out of here!");
1262 maxbet = p_ptr->lev * 200;
1264 /* We can't bet more than we have */
1265 maxbet = MIN(maxbet, p_ptr->au);
1268 strcpy(out_val, "");
1270 sprintf(tmp_str,"ÅÒ¤±¶â (1-%ld)¡©", maxbet);
1272 sprintf(tmp_str,"Your wager (1-%ld) ? ", maxbet);
1277 * Use get_string() because we may need more than
1278 * the s16b value returned by get_quantity().
1280 if (get_string(tmp_str, out_val, 32))
1283 for (p = out_val; *p == ' '; p++);
1288 if (wager > p_ptr->au)
1291 msg_print("¤ª¤¤¡ª¶â¤¬Â¤ê¤Ê¤¤¤¸¤ã¤Ê¤¤¤«¡ª½Ð¤Æ¤¤¤±¡ª");
1293 msg_print("Hey! You don't have the gold - get out of here!");
1300 else if (wager > maxbet)
1303 msg_format("%ld¥´¡¼¥ë¥É¤À¤±¼õ¤±¤è¤¦¡£»Ä¤ê¤Ï¼è¤Ã¤È¤¤Ê¡£", maxbet);
1305 msg_format("I'll take %ld gold of that. Keep the rest.", maxbet);
1313 msg_print("£Ï£Ë¡¢£±¥´¡¼¥ë¥É¤«¤é¤Ï¤¸¤á¤è¤¦¡£");
1315 msg_print("Ok, we'll start with 1 gold.");
1324 oldgold = p_ptr->au;
1327 sprintf(tmp_str, "¥²¡¼¥àÁ°¤Î½ê»ý¶â: %9ld", oldgold);
1329 sprintf(tmp_str, "Gold before game: %9ld", oldgold);
1332 prt(tmp_str, 20, 2);
1335 sprintf(tmp_str, "¸½ºß¤Î³Ý¤±¶â: %9ld", wager);
1337 sprintf(tmp_str, "Current Wager: %9ld", wager);
1340 prt(tmp_str, 21, 2);
1342 /* Prevent savefile-scumming of the casino */
1343 /* Rand_quick = TRUE; */
1344 Rand_value = time(NULL);
1348 #ifdef JP /* Prevent random seed cracking of the casino */
1356 case BACT_IN_BETWEEN: /* Game of In-Between */
1358 c_put_str(TERM_GREEN, "¥¤¥ó¡¦¥Ó¥È¥¤¡¼¥ó",5,2);
1360 c_put_str(TERM_GREEN, "In Between", 5, 2);
1365 roll1 = randint1(10);
1366 roll2 = randint1(10);
1367 choice = randint1(10);
1369 sprintf(tmp_str, "¹õ¥À¥¤¥¹: %d ¹õ¥À¥¤¥¹: %d", roll1, roll2);
1371 sprintf(tmp_str, "Black die: %d Black Die: %d", roll1, roll2);
1376 sprintf(tmp_str, "ÀÖ¥À¥¤¥¹: %d", choice);
1378 sprintf(tmp_str, "Red die: %d", choice);
1381 prt(tmp_str, 11, 14);
1382 if (((choice > roll1) && (choice < roll2)) ||
1383 ((choice < roll1) && (choice > roll2)))
1386 case BACT_CRAPS: /* Game of Craps */
1388 c_put_str(TERM_GREEN, "¥¯¥é¥Ã¥×¥¹", 5, 2);
1390 c_put_str(TERM_GREEN, "Craps", 5, 2);
1395 roll1 = randint1(6);
1396 roll2 = randint1(6);
1397 roll3 = roll1 + roll2;
1400 sprintf(tmp_str, "£±¿¶¤ê¤á: %d %d Total: %d", roll1,
1402 sprintf(tmp_str, "First roll: %d %d Total: %d", roll1,
1407 if ((roll3 == 7) || (roll3 == 11))
1409 else if ((roll3 == 2) || (roll3 == 3) || (roll3 == 12))
1415 msg_print("¤Ê¤Ë¤«¥¡¼¤ò²¡¤¹¤È¤â¤¦°ì²ó¿¶¤ê¤Þ¤¹¡£");
1417 msg_print("Hit any key to roll again");
1421 roll1 = randint1(6);
1422 roll2 = randint1(6);
1423 roll3 = roll1 + roll2;
1426 sprintf(tmp_str, "½ÐÌÜ: %d %d ¹ç·×: %d",
1428 sprintf(tmp_str, "Roll result: %d %d Total: %d",
1431 roll1, roll2, roll3);
1433 if (roll3 == choice)
1435 else if (roll3 == 7)
1437 } while ((win != TRUE) && (win != FALSE));
1440 case BACT_SPIN_WHEEL: /* Spin the Wheel Game */
1444 c_put_str(TERM_GREEN, "¥ë¡¼¥ì¥Ã¥È", 5, 2);
1446 c_put_str(TERM_GREEN, "Wheel", 5, 2);
1449 prt("0 1 2 3 4 5 6 7 8 9", 7, 5);
1450 prt("--------------------------------", 8, 3);
1451 strcpy(out_val, "");
1453 get_string("²¿ÈÖ¡© (0-9): ", out_val, 32);
1455 get_string("Pick a number (0-9): ", out_val, 32);
1458 for (p = out_val; isspace(*p); p++);
1463 msg_print("0È֤ˤ·¤È¤¯¤¼¡£");
1465 msg_print("I'll put you down for 0.");
1470 else if (choice > 9)
1473 msg_print("£Ï£Ë¡¢9È֤ˤ·¤È¤¯¤¼¡£");
1475 msg_print("Ok, I'll put you down for 9.");
1481 roll1 = randint0(10);
1483 sprintf(tmp_str, "¥ë¡¼¥ì¥Ã¥È¤Ï²ó¤ê¡¢»ß¤Þ¤Ã¤¿¡£¾¡¼Ô¤Ï %dÈÖ¤À¡£",
1485 sprintf(tmp_str, "The wheel spins to a stop and the winner is %d",
1489 prt(tmp_str, 13, 3);
1491 prt("*", 9, (3 * roll1 + 5));
1492 if (roll1 == choice)
1496 case BACT_DICE_SLOTS: /* The Dice Slots */
1498 c_put_str(TERM_GREEN, "¥À¥¤¥¹¡¦¥¹¥í¥Ã¥È", 5, 2);
1499 c_put_str(TERM_YELLOW, "¥ì¥â¥ó ¥ì¥â¥ó 2", 6, 37);
1500 c_put_str(TERM_YELLOW, "¥ì¥â¥ó ¥ì¥â¥ó ¥ì¥â¥ó 5", 7, 37);
1501 c_put_str(TERM_ORANGE, "¥ª¥ì¥ó¥¸ ¥ª¥ì¥ó¥¸ ¥ª¥ì¥ó¥¸ 10", 8, 37);
1502 c_put_str(TERM_UMBER, "·õ ·õ ·õ 20", 9, 37);
1503 c_put_str(TERM_SLATE, "½â ½â ½â 50", 10, 37);
1504 c_put_str(TERM_VIOLET, "¥×¥é¥à ¥×¥é¥à ¥×¥é¥à 200", 11, 37);
1505 c_put_str(TERM_RED, "¥Á¥§¥ê¡¼ ¥Á¥§¥ê¡¼ ¥Á¥§¥ê¡¼ 1000", 12, 37);
1507 c_put_str(TERM_GREEN, "Dice Slots", 5, 2);
1511 roll1 = randint1(21);
1521 roll2 = randint1(21);
1531 choice = randint1(21);
1541 put_str("/--------------------------\\", 7, 2);
1542 prt("\\--------------------------/", 17, 2);
1543 display_fruit(8, 3, roll1 - 1);
1544 display_fruit(8, 12, roll2 - 1);
1545 display_fruit(8, 21, choice - 1);
1546 if ((roll1 == roll2) && (roll2 == choice))
1565 else if ((roll1 == 1) && (roll2 == 1))
1574 if (odds) win = TRUE;
1581 prt("¤¢¤Ê¤¿¤Î¾¡¤Á", 16, 37);
1583 prt("YOU WON", 16, 37);
1586 p_ptr->au += odds * wager;
1588 sprintf(tmp_str, "ÇÜΨ: %d", odds);
1590 sprintf(tmp_str, "Payoff: %d", odds);
1593 prt(tmp_str, 17, 37);
1598 prt("¤¢¤Ê¤¿¤ÎÉ餱", 16, 37);
1600 prt("You Lost", 16, 37);
1606 sprintf(tmp_str, "¸½ºß¤Î½ê»ý¶â: %9ld", p_ptr->au);
1608 sprintf(tmp_str, "Current Gold: %9ld", p_ptr->au);
1611 prt(tmp_str, 22, 2);
1613 prt("¤â¤¦°ìÅÙ(Y/N)¡©", 18, 37);
1615 prt("Again(Y/N)?", 18, 37);
1618 move_cursor(18, 52);
1623 if (wager > p_ptr->au)
1626 msg_print("¤ª¤¤¡ª¶â¤¬Â¤ê¤Ê¤¤¤¸¤ã¤Ê¤¤¤«¡ª¤³¤³¤«¤é½Ð¤Æ¹Ô¤±¡ª");
1628 msg_print("Hey! You don't have the gold - get out of here!");
1636 } while ((again == 'y') || (again == 'Y'));
1638 /* Switch back to complex RNG */
1642 if (p_ptr->au >= oldgold)
1645 msg_print("¡Öº£²ó¤ÏÌÙ¤±¤¿¤Ê¡ª¤Ç¤â¼¡¤Ï¤³¤Ã¤Á¤¬¾¡¤Ã¤Æ¤ä¤ë¤«¤é¤Ê¡¢ÀäÂФˡª¡×");
1647 msg_print("You came out a winner! We'll win next time, I'm sure.");
1649 chg_virtue(V_CHANCE, 3);
1654 msg_print("¡Ö¶â¤ò¥¹¥Ã¤Æ¤·¤Þ¤Ã¤¿¤Ê¡¢¤ï¤Ï¤Ï¡ª¤¦¤Á¤Ëµ¢¤Ã¤¿Êý¤¬¤¤¤¤¤¼¡£¡×");
1656 msg_print("You lost gold! Haha, better head home.");
1658 chg_virtue(V_CHANCE, -3);
1667 static bool vault_aux_battle(int r_idx)
1672 monster_race *r_ptr = &r_info[r_idx];
1674 /* Decline town monsters */
1675 /* if (!monster_dungeon(r_idx)) return FALSE; */
1677 /* Decline unique monsters */
1678 /* if (r_ptr->flags1 & (RF1_UNIQUE)) return (FALSE); */
1679 /* if (r_ptr->flags7 & (RF7_UNIQUE_7)) return (FALSE); */
1681 if (r_ptr->flags1 & (RF1_NEVER_MOVE)) return (FALSE);
1682 if (r_ptr->flags2 & (RF2_MULTIPLY)) return (FALSE);
1683 if (r_ptr->flags2 & (RF2_QUANTUM)) return (FALSE);
1684 if (r_ptr->flags7 & (RF7_AQUATIC)) return (FALSE);
1685 if (r_ptr->flags7 & (RF7_CHAMELEON)) return (FALSE);
1687 for (i = 0; i < 4; i++)
1689 if (r_ptr->blow[i].method == RBM_EXPLODE) return (FALSE);
1690 if (r_ptr->blow[i].effect != RBE_DR_MANA) dam += r_ptr->blow[i].d_dice;
1692 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);
1698 void battle_monsters(void)
1705 bool old_inside_battle = p_ptr->inside_battle;
1707 for (i = 0; i < max_d_idx; i++)
1708 if (max_dl < max_dlv[i]) max_dl = max_dlv[i];
1710 mon_level = randint1(MIN(max_dl, 122))+5;
1711 if (randint0(100) < 60)
1713 i = randint1(MIN(max_dl, 122))+5;
1714 mon_level = MAX(i, mon_level);
1716 if (randint0(100) < 30)
1718 i = randint1(MIN(max_dl, 122))+5;
1719 mon_level = MAX(i, mon_level);
1731 get_mon_num_prep(vault_aux_battle, NULL);
1732 p_ptr->inside_battle = TRUE;
1733 r_idx = get_mon_num(mon_level);
1734 p_ptr->inside_battle = old_inside_battle;
1735 if (!r_idx) continue;
1737 if ((r_info[r_idx].flags1 & RF1_UNIQUE) || (r_info[r_idx].flags7 & RF7_UNIQUE2))
1739 if ((r_info[r_idx].level + 10) > mon_level) continue;
1742 for (j = 0; j < i; j++)
1743 if(r_idx == battle_mon[j]) break;
1748 battle_mon[i] = r_idx;
1749 if (r_info[r_idx].level < 45) tekitou = TRUE;
1754 monster_race *r_ptr = &r_info[battle_mon[i]];
1755 int num_taisei = count_bits(r_ptr->flags3 & (RF3_IM_ACID | RF3_IM_ELEC | RF3_IM_FIRE | RF3_IM_COLD | RF3_IM_POIS));
1757 if (r_ptr->flags1 & RF1_FORCE_MAXHP)
1758 power[i] = r_ptr->hdice * r_ptr->hside * 2;
1760 power[i] = r_ptr->hdice * (r_ptr->hside + 1);
1761 power[i] = power[i] * (100 + r_ptr->level) / 100;
1762 if (r_ptr->speed > 110)
1763 power[i] = power[i] * (r_ptr->speed * 2 - 110) / 100;
1764 if (r_ptr->speed < 110)
1765 power[i] = power[i] * (r_ptr->speed - 20) / 100;
1767 power[i] = power[i] * (num_taisei*2+5) / 10;
1768 else if (r_ptr->flags6 & RF6_INVULNER)
1769 power[i] = power[i] * 4 / 3;
1770 else if (r_ptr->flags6 & RF6_HEAL)
1771 power[i] = power[i] * 4 / 3;
1772 else if (r_ptr->flags5 & RF5_DRAIN_MANA)
1773 power[i] = power[i] * 11 / 10;
1774 if (r_ptr->flags1 & RF1_RAND_25)
1775 power[i] = power[i] * 9 / 10;
1776 if (r_ptr->flags1 & RF1_RAND_50)
1777 power[i] = power[i] * 9 / 10;
1779 switch (battle_mon[i])
1790 case MON_UND_BEHOLDER:
1791 case MON_SANTACLAUS:
1792 case MON_ULT_BEHOLDER:
1794 case MON_ATLACH_NACHA:
1796 power[i] = power[i] * 3 / 5;
1798 case MON_ROBIN_HOOD:
1802 case MON_CRYPT_THING:
1803 case MON_MASTER_LICH:
1804 case MON_DREADMASTER:
1806 case MON_SHADOWLORD:
1811 case MON_VENOM_WYRM:
1812 case MON_MASTER_MYS:
1813 case MON_G_MASTER_MYS:
1814 power[i] = power[i] * 3 / 4;
1816 case MON_VORPAL_BUNNY:
1819 case MON_LOG_MASTER:
1821 case MON_GRAV_HOUND:
1824 case MON_CLUB_DEMON:
1826 case MON_NIGHTCRAWLER:
1827 case MON_NIGHTWALKER:
1833 case MON_SPECT_WYRM:
1838 power[i] = power[i] * 4 / 3;
1840 case MON_UMBER_HULK:
1844 case MON_ENERGY_VOR:
1848 case MON_PLASMA_VOR:
1853 case MON_STORMBRINGER:
1854 case MON_TIME_HOUND:
1855 case MON_PLASMA_HOUND:
1858 case MON_AETHER_VOR:
1859 case MON_AETHER_HOUND:
1867 case MON_D_ELF_SHADE:
1868 case MON_MANA_HOUND:
1870 case MON_BANORLUPART:
1875 power[i] = power[i] * 3 / 2;
1879 case MON_CYBER_KING:
1880 case MON_UNICORN_ORD:
1881 power[i] = power[i] * 5 / 3;
1885 case MON_WYRM_POWER:
1905 power[i] = total*60/power[i];
1906 if (tekitou && ((power[i] < 160) || power[i] > 1500)) break;
1907 if ((power[i] < 160) && randint0(20)) break;
1908 if (power[i] < 101) power[i] = 100 + randint1(5);
1909 mon_odds[i] = power[i];
1915 static bool kakutoujou(void)
1919 char out_val[160], tmp_str[80];
1922 if ((turn - old_battle) > TURNS_PER_TICK*250)
1934 msg_print("¤ª¤¤¡ª¤ª¤Þ¤¨°ìʸ¤Ê¤·¤¸¤ã¤Ê¤¤¤«¡ª¤³¤Ã¤«¤é½Ð¤Æ¤¤¤±¡ª");
1936 msg_print("Hey! You don't have gold - get out of here!");
1950 prt("¥â¥ó¥¹¥¿¡¼ ÇÜΨ", 4, 4);
1952 prt("Monsters Odds", 4, 4);
1957 monster_race *r_ptr = &r_info[battle_mon[i]];
1960 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);
1962 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);
1968 prt("¤É¤ì¤ËÅÒ¤±¤Þ¤¹¤«:", 0, 0);
1970 prt("Which monster: ", 0, 0);
1981 if (i >= '1' && i <= '4')
1983 sel_monster = i-'1';
1984 battle_odds = mon_odds[sel_monster];
1992 if (i !=sel_monster) clear_bldg(i+5,i+5);
1994 maxbet = p_ptr->lev * 200;
1996 /* We can't bet more than we have */
1997 maxbet = MIN(maxbet, p_ptr->au);
2000 strcpy(out_val, "");
2002 sprintf(tmp_str,"ÅÒ¤±¶â (1-%ld)¡©", maxbet);
2004 sprintf(tmp_str,"Your wager (1-%ld) ? ", maxbet);
2009 * Use get_string() because we may need more than
2010 * the s16b value returned by get_quantity().
2012 if (get_string(tmp_str, out_val, 32))
2015 for (p = out_val; *p == ' '; p++);
2020 if (wager > p_ptr->au)
2023 msg_print("¤ª¤¤¡ª¶â¤¬Â¤ê¤Ê¤¤¤¸¤ã¤Ê¤¤¤«¡ª½Ð¤Æ¤¤¤±¡ª");
2025 msg_print("Hey! You don't have the gold - get out of here!");
2032 else if (wager > maxbet)
2035 msg_format("%ld¥´¡¼¥ë¥É¤À¤±¼õ¤±¤è¤¦¡£»Ä¤ê¤Ï¼è¤Ã¤È¤¤Ê¡£", maxbet);
2037 msg_format("I'll take %ld gold of that. Keep the rest.", maxbet);
2045 msg_print("£Ï£Ë¡¢£±¥´¡¼¥ë¥É¤Ç¤¤¤³¤¦¡£");
2047 msg_print("Ok, we'll start with 1 gold.");
2054 battle_odds = MAX(wager+1, wager * battle_odds / 100);
2057 p_ptr->leftbldg = TRUE;
2058 p_ptr->inside_battle = TRUE;
2060 p_ptr->leaving = TRUE;
2072 static void today_target(void)
2075 monster_race *r_ptr = &r_info[today_mon];
2079 c_put_str(TERM_YELLOW, "ËÜÆü¤Î¾Þ¶â¼ó", 5, 10);
2081 prt("Wanted monster that changes from day to day", 5, 10);
2084 sprintf(buf,"¥¿¡¼¥²¥Ã¥È¡§ %s",r_name + r_ptr->name);
2086 sprintf(buf,"target: %s",r_name + r_ptr->name);
2088 c_put_str(TERM_YELLOW, buf, 6, 10);
2090 sprintf(buf,"»àÂÎ ---- $%d",r_ptr->level * 50 + 100);
2092 sprintf(buf,"corpse ---- $%d",r_ptr->level * 50 + 100);
2096 sprintf(buf,"¹ü ---- $%d",r_ptr->level * 30 + 60);
2098 sprintf(buf,"skeleton ---- $%d",r_ptr->level * 30 + 60);
2101 p_ptr->today_mon = today_mon;
2104 static void tsuchinoko(void)
2108 c_put_str(TERM_YELLOW, "°ì³ÍÀé¶â¤ÎÂç¥Á¥ã¥ó¥¹¡ª¡ª¡ª", 5, 10);
2109 c_put_str(TERM_YELLOW, "¥¿¡¼¥²¥Ã¥È¡§¸¸¤ÎÄÁ½Ã¡Ö¥Ä¥Á¥Î¥³¡×", 6, 10);
2110 c_put_str(TERM_WHITE, "À¸¤±Êá¤ê ---- $1,000,000", 8, 10);
2111 c_put_str(TERM_WHITE, "»àÂÎ ---- $200,000", 9, 10);
2112 c_put_str(TERM_WHITE, "¹ü ---- $100,000", 10, 10);
2114 c_put_str(TERM_YELLOW, "Big chance to quick money!!!", 5, 10);
2115 c_put_str(TERM_YELLOW, "target: the rarest animal 'Tsuchinoko'", 6, 10);
2116 c_put_str(TERM_WHITE, "catch alive ---- $1,000,000", 8, 10);
2117 c_put_str(TERM_WHITE, "corpse ---- $200,000", 9, 10);
2118 c_put_str(TERM_WHITE, "bones ---- $100,000", 10, 10);
2122 static void shoukinkubi(void)
2130 prt("»àÂΤò»ý¤Áµ¢¤ë¤È¾Þ¶â¤òº¹¤·¾å¤²¤Þ¤¹¡£",4 ,10);
2131 c_put_str(TERM_YELLOW, "¸½ºß¤Î¾Þ¶â¼ó", 6, 10);
2133 prt("Offer a prize when you bring a wanted monster's corpse",4 ,10);
2134 c_put_str(TERM_YELLOW, "Wanted monsters", 6, 10);
2137 for (i = 0; i < MAX_KUBI; i++)
2140 monster_race *r_ptr = &r_info[(kubi_r_idx[i] > 10000 ? kubi_r_idx[i] - 10000 : kubi_r_idx[i])];
2142 sprintf(buf,"%-40s ---- ",r_name + r_ptr->name);
2144 if (kubi_r_idx[i] > 10000)
2146 c_put_str(TERM_RED,"ºÑ", y+7, 56);
2148 c_put_str(TERM_RED,"done", y+7, 56);
2152 sprintf(buf,"$%d", 300 * (r_ptr->level + 1));
2156 if (!y && (i < MAX_KUBI -1))
2159 prt("²¿¤«¥¡¼¤ò²¡¤·¤Æ¤¯¤À¤µ¤¤", 0, 0);
2161 prt("Hit any key.", 0, 0);
2170 static bool kankin(void)
2173 bool change = FALSE;
2174 char o_name[MAX_NLEN];
2177 for (i = 0;i <= INVEN_LARM; i++)
2179 o_ptr = &inventory[i];
2180 if ((o_ptr->tval == TV_CAPTURE) && (o_ptr->pval == MON_TSUCHINOKO))
2182 char buf[MAX_NLEN+20];
2183 object_desc(o_name, o_ptr, TRUE, 3);
2185 sprintf(buf, "%s ¤ò´¹¶â¤·¤Þ¤¹¤«¡©",o_name);
2187 sprintf(buf, "Convert %s into money? ",o_name);
2192 msg_format("¾Þ¶â %ld¡ð¤ò¼ê¤ËÆþ¤ì¤¿¡£", 1000000L * o_ptr->number);
2194 msg_format("You get %ldgp.", 1000000L * o_ptr->number);
2196 p_ptr->au += 1000000L * o_ptr->number;
2197 p_ptr->redraw |= (PR_GOLD);
2198 inven_item_increase(i, -o_ptr->number);
2199 inven_item_describe(i);
2200 inven_item_optimize(i);
2205 for (i = 0;i <= INVEN_LARM; i++)
2207 o_ptr = &inventory[i];
2208 if ((o_ptr->tval == TV_CORPSE) && (o_ptr->sval == SV_CORPSE) && (o_ptr->pval == MON_TSUCHINOKO))
2210 char buf[MAX_NLEN+20];
2211 object_desc(o_name, o_ptr, TRUE, 3);
2213 sprintf(buf, "%s ¤ò´¹¶â¤·¤Þ¤¹¤«¡©",o_name);
2215 sprintf(buf, "Convert %s into money? ",o_name);
2220 msg_format("¾Þ¶â %ld¡ð¤ò¼ê¤ËÆþ¤ì¤¿¡£", 200000L * o_ptr->number);
2222 msg_format("You get %ldgp.", 200000L * o_ptr->number);
2224 p_ptr->au += 200000L * o_ptr->number;
2225 p_ptr->redraw |= (PR_GOLD);
2226 inven_item_increase(i, -o_ptr->number);
2227 inven_item_describe(i);
2228 inven_item_optimize(i);
2233 for (i = 0;i <= INVEN_LARM; i++)
2235 o_ptr = &inventory[i];
2236 if ((o_ptr->tval == TV_CORPSE) && (o_ptr->sval == SV_SKELETON) && (o_ptr->pval == MON_TSUCHINOKO))
2238 char buf[MAX_NLEN+20];
2239 object_desc(o_name, o_ptr, TRUE, 3);
2241 sprintf(buf, "%s ¤ò´¹¶â¤·¤Þ¤¹¤«¡©",o_name);
2243 sprintf(buf, "Convert %s into money? ",o_name);
2248 msg_format("¾Þ¶â %ld¡ð¤ò¼ê¤ËÆþ¤ì¤¿¡£", 100000L * o_ptr->number);
2250 msg_format("You get %ldgp.", 100000L * o_ptr->number);
2252 p_ptr->au += 100000L * o_ptr->number;
2253 p_ptr->redraw |= (PR_GOLD);
2254 inven_item_increase(i, -o_ptr->number);
2255 inven_item_describe(i);
2256 inven_item_optimize(i);
2262 for (i = 0;i <= INVEN_LARM; i++)
2264 o_ptr = &inventory[i];
2265 if ((o_ptr->tval == TV_CORPSE) && (o_ptr->sval == SV_CORPSE) && (o_ptr->pval == today_mon))
2267 char buf[MAX_NLEN+20];
2268 object_desc(o_name, o_ptr, TRUE, 3);
2270 sprintf(buf, "%s ¤ò´¹¶â¤·¤Þ¤¹¤«¡©",o_name);
2272 sprintf(buf, "Convert %s into money? ",o_name);
2277 msg_format("¾Þ¶â %ld¡ð¤ò¼ê¤ËÆþ¤ì¤¿¡£", (r_info[today_mon].level * 50 + 100) * o_ptr->number);
2279 msg_format("You get %ldgp.", (r_info[today_mon].level * 50 + 100) * o_ptr->number);
2281 p_ptr->au += (r_info[today_mon].level * 50 + 100) * o_ptr->number;
2282 p_ptr->redraw |= (PR_GOLD);
2283 inven_item_increase(i, -o_ptr->number);
2284 inven_item_describe(i);
2285 inven_item_optimize(i);
2290 for (i = 0;i <= INVEN_LARM; i++)
2292 o_ptr = &inventory[i];
2293 if ((o_ptr->tval == TV_CORPSE) && (o_ptr->sval == SV_SKELETON) && (o_ptr->pval == today_mon))
2295 char buf[MAX_NLEN+20];
2296 object_desc(o_name, o_ptr, TRUE, 3);
2298 sprintf(buf, "%s ¤ò´¹¶â¤·¤Þ¤¹¤«¡©",o_name);
2300 sprintf(buf, "Convert %s into money? ",o_name);
2305 msg_format("¾Þ¶â %ld¡ð¤ò¼ê¤ËÆþ¤ì¤¿¡£", (r_info[today_mon].level * 30 + 60) * o_ptr->number);
2307 msg_format("You get %ldgp.", (r_info[today_mon].level * 30 + 60) * o_ptr->number);
2309 p_ptr->au += (r_info[today_mon].level * 30 + 60) * o_ptr->number;
2310 p_ptr->redraw |= (PR_GOLD);
2311 inven_item_increase(i, -o_ptr->number);
2312 inven_item_describe(i);
2313 inven_item_optimize(i);
2319 for (j = 0; j < MAX_KUBI; j++)
2321 for (i = 0;i <= INVEN_LARM; i++)
2323 o_ptr = &inventory[i];
2324 if ((o_ptr->tval == TV_CORPSE) && (o_ptr->sval == SV_CORPSE) && (o_ptr->pval == kubi_r_idx[j]))
2326 char buf[MAX_NLEN+20];
2327 object_desc(o_name, o_ptr, TRUE, 3);
2329 sprintf(buf, "%s ¤ò´¹¶â¤·¤Þ¤¹¤«¡©",o_name);
2331 sprintf(buf, "Convert %s into money? ",o_name);
2336 msg_format("¾Þ¶â %ld¡ð¤ò¼ê¤ËÆþ¤ì¤¿¡£", (r_info[kubi_r_idx[j]].level + 1) * 300 * o_ptr->number);
2338 msg_format("You get %ldgp.", (r_info[kubi_r_idx[j]].level + 1) * 300 * o_ptr->number);
2340 p_ptr->au += (r_info[kubi_r_idx[j]].level+1) * 300 * o_ptr->number;
2341 p_ptr->redraw |= (PR_GOLD);
2342 inven_item_increase(i, -o_ptr->number);
2343 inven_item_describe(i);
2344 inven_item_optimize(i);
2345 chg_virtue(V_JUSTICE, 5);
2346 kubi_r_idx[j] += 10000;
2356 msg_print("¾Þ¶â¤òÆÀ¤é¤ì¤½¤¦¤Ê¤â¤Î¤Ï»ý¤Ã¤Æ¤¤¤Ê¤«¤Ã¤¿¡£");
2358 msg_print("You have nothing.");
2366 bool get_nightmare(int r_idx)
2368 monster_race *r_ptr = &r_info[r_idx];
2370 /* Require eldritch horrors */
2371 if (!(r_ptr->flags2 & (RF2_ELDRITCH_HORROR))) return (FALSE);
2373 /* Require high level */
2374 if (r_ptr->level <= p_ptr->lev) return (FALSE);
2376 /* Accept this monster */
2381 void have_nightmare(int r_idx)
2383 bool happened = FALSE;
2384 monster_race *r_ptr = &r_info[r_idx];
2385 int power = r_ptr->level + 10;
2387 cptr desc = r_name + r_ptr->name;
2391 if (!(r_ptr->flags1 & RF1_UNIQUE))
2392 sprintf(m_name, "%s %s", (is_a_vowel(desc[0]) ? "an" : "a"), desc);
2395 sprintf(m_name, "%s", desc);
2397 if (!(r_ptr->flags1 & RF1_UNIQUE))
2399 if (r_ptr->flags1 & RF1_FRIENDS) power /= 2;
2403 if (saving_throw(p_ptr->skill_sav * 100 / power))
2406 msg_format("Ì´¤ÎÃæ¤Ç%s¤ËÄɤ¤¤«¤±¤é¤ì¤¿¡£", m_name);
2408 msg_format("%^s chases you through your dreams.", m_name);
2417 /* Something silly happens... */
2419 msg_format("%s%s¤Î´é¤ò¸«¤Æ¤·¤Þ¤Ã¤¿¡ª",
2421 msg_format("You behold the %s visage of %s!",
2424 funny_desc[randint0(MAX_SAN_FUNNY)], m_name);
2428 msg_print(funny_comments[randint0(MAX_SAN_COMMENT)]);
2429 p_ptr->image = p_ptr->image + randint1(r_ptr->level);
2432 /* Never mind; we can't see it clearly enough */
2436 /* Something frightening happens... */
2438 msg_format("%s%s¤Î´é¤ò¸«¤Æ¤·¤Þ¤Ã¤¿¡ª",
2440 msg_format("You behold the %s visage of %s!",
2443 horror_desc[randint0(MAX_SAN_HORROR)], desc);
2445 r_ptr->r_flags2 |= RF2_ELDRITCH_HORROR;
2447 switch (p_ptr->prace)
2449 /* Imps may make a saving throw */
2453 if (saving_throw(20 + p_ptr->lev)) return;
2455 /* Undead may make a saving throw */
2461 if (saving_throw(10 + p_ptr->lev)) return;
2466 if (!saving_throw(p_ptr->skill_sav * 100 / power))
2468 if (!p_ptr->resist_conf)
2470 (void)set_confused(p_ptr->confused + randint0(4) + 4);
2472 if (!p_ptr->resist_chaos && one_in_(3))
2474 (void)set_image(p_ptr->image + randint0(250) + 150);
2479 /* Lose int & wis */
2480 if (!saving_throw(p_ptr->skill_sav * 100 / power))
2488 if (!saving_throw(p_ptr->skill_sav * 100 / power))
2490 if (!p_ptr->resist_conf)
2492 (void)set_confused(p_ptr->confused + randint0(4) + 4);
2494 if (!p_ptr->free_act)
2496 (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
2498 while (!saving_throw(p_ptr->skill_sav))
2500 (void)do_dec_stat(A_INT);
2502 while (!saving_throw(p_ptr->skill_sav))
2504 (void)do_dec_stat(A_WIS);
2506 if (!p_ptr->resist_chaos)
2508 (void)set_image(p_ptr->image + randint0(250) + 150);
2515 if (!saving_throw(p_ptr->skill_sav * 100 / power))
2517 if (lose_all_info())
2520 msg_print("¤¢¤Þ¤ê¤Î¶²ÉݤËÁ´¤Æ¤Î¤³¤È¤ò˺¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª");
2522 msg_print("You forget everything in your utmost terror!");
2529 /* Else gain permanent insanity */
2530 if ((p_ptr->muta3 & MUT3_MORONIC) && (p_ptr->muta2 & MUT2_BERS_RAGE) &&
2531 ((p_ptr->muta2 & MUT2_COWARDICE) || (p_ptr->resist_fear)) &&
2532 ((p_ptr->muta2 & MUT2_HALLU) || (p_ptr->resist_chaos)))
2534 /* The poor bastard already has all possible insanities! */
2540 switch (randint1(4))
2544 if (!(p_ptr->muta3 & MUT3_MORONIC))
2546 if ((p_ptr->stat_use[A_INT] < 4) && (p_ptr->stat_use[A_WIS] < 4))
2549 msg_print("¤¢¤Ê¤¿¤Ï´°àú¤ÊÇϼ¯¤Ë¤Ê¤Ã¤¿¤è¤¦¤Êµ¤¤¬¤·¤¿¡£¤·¤«¤·¤½¤ì¤Ï¸µ¡¹¤À¤Ã¤¿¡£");
2551 msg_print("You turn into an utter moron!");
2557 msg_print("¤¢¤Ê¤¿¤Ï´°àú¤ÊÇϼ¯¤Ë¤Ê¤Ã¤¿¡ª");
2559 msg_print("You turn into an utter moron!");
2563 if (p_ptr->muta3 & MUT3_HYPER_INT)
2566 msg_print("¤¢¤Ê¤¿¤ÎǾ¤ÏÀ¸ÂÎ¥³¥ó¥Ô¥å¡¼¥¿¤Ç¤Ï¤Ê¤¯¤Ê¤Ã¤¿¡£");
2568 msg_print("Your brain is no longer a living computer.");
2571 p_ptr->muta3 &= ~(MUT3_HYPER_INT);
2573 p_ptr->muta3 |= MUT3_MORONIC;
2580 if (!(p_ptr->muta2 & MUT2_COWARDICE) && !p_ptr->resist_fear)
2583 msg_print("¤¢¤Ê¤¿¤Ï¥Ñ¥é¥Î¥¤¥¢¤Ë¤Ê¤Ã¤¿¡ª");
2585 msg_print("You become paranoid!");
2589 /* Duh, the following should never happen, but anyway... */
2590 if (p_ptr->muta3 & MUT3_FEARLESS)
2593 msg_print("¤¢¤Ê¤¿¤Ï¤â¤¦¶²¤ìÃΤ餺¤Ç¤Ï¤Ê¤¯¤Ê¤Ã¤¿¡£");
2595 msg_print("You are no longer fearless.");
2598 p_ptr->muta3 &= ~(MUT3_FEARLESS);
2601 p_ptr->muta2 |= MUT2_COWARDICE;
2608 if (!(p_ptr->muta2 & MUT2_HALLU) && !p_ptr->resist_chaos)
2611 msg_print("¸¸³Ð¤ò¤Ò¤µ¯¤³¤¹Àº¿ÀºøÍð¤Ë´Ù¤Ã¤¿¡ª");
2613 msg_print("You are afflicted by a hallucinatory insanity!");
2616 p_ptr->muta2 |= MUT2_HALLU;
2623 if (!(p_ptr->muta2 & MUT2_BERS_RAGE))
2626 msg_print("·ãÎõ¤Ê´¶¾ð¤Îȯºî¤Ë¤ª¤½¤ï¤ì¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¡ª");
2628 msg_print("You become subject to fits of berserk rage!");
2631 p_ptr->muta2 |= MUT2_BERS_RAGE;
2639 p_ptr->update |= PU_BONUS;
2646 * Note that resting for the night was a perfect way to avoid player
2647 * ghosts in the town *if* you could only make it to the inn in time (-:
2648 * Now that the ghosts are temporarily disabled in 2.8.X, this function
2649 * will not be that useful. I will keep it in the hopes the player
2650 * ghost code does become a reality again. Does help to avoid filthy urchins.
2651 * Resting at night is also a quick way to restock stores -KMW-
2653 static bool inn_comm(int cmd)
2659 case BACT_FOOD: /* Buy food & drink */
2661 msg_print("¥Ð¡¼¥Æ¥ó¤Ï¤¤¤¯¤é¤«¤Î¿©¤Ùʪ¤È¥Ó¡¼¥ë¤ò¤¯¤ì¤¿¡£");
2663 msg_print("The barkeep gives you some gruel and a beer.");
2666 (void)set_food(PY_FOOD_MAX - 1);
2669 case BACT_REST: /* Rest for the night */
2670 dawnval = ((turn % (TURNS_PER_TICK * TOWN_DAWN)));
2671 if (dawnval > (TURNS_PER_TICK * TOWN_DAWN)/4)
2673 if ((p_ptr->poisoned) || (p_ptr->cut))
2676 msg_print("¤¢¤Ê¤¿¤ËɬÍפʤΤÏÉô²°¤Ç¤Ï¤Ê¤¯¡¢¼£ÎżԤǤ¹¡£");
2678 msg_print("You need a healer, not a room.");
2683 msg_print("¤¹¤ß¤Þ¤»¤ó¡¢¤Ç¤â¤¦¤Á¤Ç狼¤Ë»à¤Ê¤ì¤Á¤ãº¤¤ê¤Þ¤¹¤ó¤Ç¡£");
2685 msg_print("Sorry, but don't want anyone dying in here.");
2693 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "½É²°¤ËÇñ¤Þ¤Ã¤¿¡£");
2695 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "stay over night at the inn");
2697 turn = (turn / (TURNS_PER_TICK*TOWN_DAWN/2) + 1) * (TURNS_PER_TICK*TOWN_DAWN/2);
2698 if (((oldturn + TURNS_PER_TICK * TOWN_DAWN / 4) % (TURNS_PER_TICK * TOWN_DAWN)) > TURNS_PER_TICK * TOWN_DAWN/4) do_cmd_write_nikki(NIKKI_HIGAWARI, 0, NULL);
2699 p_ptr->chp = p_ptr->mhp;
2701 dungeon_turn += MIN(turn - oldturn, TURNS_PER_TICK*250);
2703 if (ironman_nightmare)
2706 msg_print("̲¤ê¤Ë½¢¤¯¤È¶²¤í¤·¤¤¸÷·Ê¤¬¿´¤ò¤è¤®¤Ã¤¿¡£");
2708 msg_print("Horrible visions flit through your mind as you sleep.");
2712 /* Pick a nightmare */
2713 get_mon_num_prep(get_nightmare, NULL);
2715 /* Have some nightmares */
2718 have_nightmare(get_mon_num(MAX_DEPTH));
2720 if (!one_in_(3)) break;
2723 /* Remove the monster restriction */
2724 get_mon_num_prep(NULL, NULL);
2727 msg_print("¤¢¤Ê¤¿¤ÏÀ䶫¤·¤ÆÌܤò³Ð¤Þ¤·¤¿¡£");
2729 msg_print("You awake screaming.");
2733 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "°Ì´¤Ë¤¦¤Ê¤µ¤ì¤Æ¤è¤¯Ì²¤ì¤Ê¤«¤Ã¤¿¡£");
2735 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "be troubled by a nightmare.");
2743 p_ptr->chp = p_ptr->mhp;
2744 p_ptr->csp = p_ptr->msp;
2745 if (p_ptr->pclass == CLASS_MAGIC_EATER)
2748 for (i = 0; i < 72; i++)
2750 p_ptr->magic_num1[i] = p_ptr->magic_num2[i]*EATER_CHARGE;
2752 for (; i < 108; i++)
2754 p_ptr->magic_num1[i] = 0;
2759 msg_print("¤¢¤Ê¤¿¤Ï¥ê¥Õ¥ì¥Ã¥·¥å¤·¤ÆÌܳФᡢ¿·¤¿¤ÊÆü¤ò·Þ¤¨¤¿¡£");
2761 msg_print("You awake refreshed for the new day.");
2765 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "¤¹¤¬¤¹¤¬¤·¤¤Ä«¤ò¤à¤«¤¨¤¿¡£");
2767 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "awake refreshed.");
2771 p_ptr->leftbldg = TRUE;
2777 msg_print("Éô²°¤ÏÌë¤À¤±»ÈÍѲÄǽ¤Ç¤¹¡£");
2779 msg_print("The rooms are available only at night.");
2785 case BACT_RUMORS: /* Listen for rumors */
2790 if (!get_rnd_line_jonly("rumors_j.txt", 0, Rumor, 10))
2792 if (!get_rnd_line("rumors.txt", 0, Rumor))
2795 msg_format("%s", Rumor);
2805 * Share gold for thieves
2807 static void share_gold(void)
2809 int i = (p_ptr->lev * 2) * 10;
2811 msg_format("¡ð%d ¤ò¼ê¤ËÆþ¤ì¤¿¡£", i);
2813 msg_format("You collect %d gold pieces", i);
2821 * Display quest information
2823 static void get_questinfo(int questnum)
2830 /* Clear the text */
2831 for (i = 0; i < 10; i++)
2833 quest_text[i][0] = '\0';
2836 quest_text_line = 0;
2838 /* Set the quest number temporary */
2839 old_quest = p_ptr->inside_quest;
2840 p_ptr->inside_quest = questnum;
2842 /* Get the quest text */
2843 init_flags = INIT_SHOW_TEXT | INIT_ASSIGN;
2845 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
2847 /* Reset the old quest number */
2848 p_ptr->inside_quest = old_quest;
2850 /* Print the quest info */
2852 sprintf(tmp_str, "¥¯¥¨¥¹¥È¾ðÊó (´í¸±ÅÙ: %d ³¬ÁêÅö)", quest[questnum].level);
2854 sprintf(tmp_str, "Quest Information (Danger level: %d)", quest[questnum].level);
2859 prt(quest[questnum].name, 7, 0);
2861 for (i = 0; i < 10; i++)
2863 c_put_str(TERM_YELLOW, quest_text[i], i + 8, 0);
2869 * Request a quest from the Lord.
2871 static void castle_quest(void)
2874 monster_race *r_ptr;
2881 /* Current quest of the building */
2882 q_index = cave[py][px].special;
2884 /* Is there a quest available at the building? */
2888 put_str("º£¤Î¤È¤³¤í¥¯¥¨¥¹¥È¤Ï¤¢¤ê¤Þ¤»¤ó¡£", 8, 0);
2890 put_str("I don't have a quest for you at the moment.", 8, 0);
2896 q_ptr = &quest[q_index];
2898 /* Quest is completed */
2899 if (q_ptr->status == QUEST_STATUS_COMPLETED)
2901 /* Rewarded quest */
2902 q_ptr->status = QUEST_STATUS_REWARDED;
2904 get_questinfo(q_index);
2906 reinit_wilderness = TRUE;
2909 else if (q_ptr->status == QUEST_STATUS_FAILED)
2911 get_questinfo(q_index);
2913 /* Mark quest as done (but failed) */
2914 q_ptr->status = QUEST_STATUS_FAILED_DONE;
2916 reinit_wilderness = TRUE;
2918 /* Quest is still unfinished */
2919 else if (q_ptr->status == QUEST_STATUS_TAKEN)
2922 put_str("¤¢¤Ê¤¿¤Ï¸½ºß¤Î¥¯¥¨¥¹¥È¤ò½ªÎ»¤µ¤»¤Æ¤¤¤Þ¤»¤ó¡ª", 8, 0);
2924 put_str("You have not completed your current quest yet!", 8, 0);
2928 put_str("CTRL-Q¤ò»È¤¨¤Ð¥¯¥¨¥¹¥È¤Î¾õÂÖ¤¬¥Á¥§¥Ã¥¯¤Ç¤¤Þ¤¹¡£", 9, 0);
2930 put_str("Use CTRL-Q to check the status of your quest.", 9, 0);
2934 put_str("¥¯¥¨¥¹¥È¤ò½ª¤ï¤é¤»¤¿¤éÌá¤Ã¤ÆÍè¤Æ²¼¤µ¤¤¡£", 12, 0);
2936 put_str("Return when you have completed your quest.", 12, 0);
2941 else if (q_ptr->status == QUEST_STATUS_UNTAKEN)
2943 q_ptr->status = QUEST_STATUS_TAKEN;
2945 reinit_wilderness = TRUE;
2947 /* Assign a new quest */
2948 if (q_ptr->type == QUEST_TYPE_KILL_ANY_LEVEL)
2950 if (q_ptr->r_idx == 0)
2952 /* Random monster at least 5 - 10 levels out of deep */
2953 q_ptr->r_idx = get_mon_num(q_ptr->level + 4 + randint1(6));
2956 r_ptr = &r_info[q_ptr->r_idx];
2958 while ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->rarity != 1))
2960 q_ptr->r_idx = get_mon_num(q_ptr->level) + 4 + randint1(6);
2961 r_ptr = &r_info[q_ptr->r_idx];
2964 if (q_ptr->max_num == 0)
2966 /* Random monster number */
2967 if (randint1(10) > 7)
2970 q_ptr->max_num = randint1(3) + 1;
2974 name = (r_name + r_ptr->name);
2976 msg_format("¥¯¥¨¥¹¥È: %s¤ò %dÂÎÅݤ¹", name,q_ptr->max_num);
2978 msg_format("Your quest: kill %d %s", q_ptr->max_num, name);
2984 get_questinfo(q_index);
2991 * Display town history
2993 static void town_history(void)
2998 /* Peruse the building help file */
3000 (void)show_file(TRUE, "jbldg.txt", NULL, 0, 0);
3002 (void)show_file(TRUE, "bldg.txt", NULL, 0, 0);
3012 * Display the damage figure of an object
3013 * (used by compare_weapon_aux1)
3015 * Only accurate for the current weapon, because it includes
3016 * the current +dam of the player.
3018 static void compare_weapon_aux2(object_type *o_ptr, int numblows,
3019 int r, int c, int mult, cptr attr,
3024 /* Print the intro text */
3025 c_put_str(color, attr, r, c);
3027 /* Calculate the min and max damage figures */
3029 sprintf(tmp_str, "£±¥¿¡¼¥ó: %d-%d ¥À¥á¡¼¥¸",
3031 sprintf(tmp_str, "Attack: %d-%d damage",
3034 (numblows * (mult * o_ptr->dd /60 + o_ptr->to_d + p_ptr->to_d[0])),
3035 (numblows * (mult * o_ptr->ds * o_ptr->dd /60 + o_ptr->to_d + p_ptr->to_d[0])));
3037 /* Print the damage */
3038 put_str(tmp_str, r, c + 8);
3043 * Show the damage figures for the various monster types
3045 * Only accurate for the current weapon, because it includes
3046 * the current number of blows for the player.
3048 static void compare_weapon_aux1(object_type *o_ptr, int col, int r)
3051 u32b flgs[TR_FLAG_SIZE];
3052 int blow = p_ptr->num_blow[0];
3054 /* Get the flags of the weapon */
3055 object_flags(o_ptr, flgs);
3059 if ((o_ptr->tval == TV_POLEARM) && ((o_ptr->sval == SV_LANCE) || (o_ptr->sval == SV_HEAVY_LANCE)))
3060 mult = mult * (o_ptr->dd + 2) / o_ptr->dd;
3062 if ((p_ptr->pclass != CLASS_SAMURAI) && (have_flag(flgs, TR_FORCE_WEAPON)) && (p_ptr->csp > (o_ptr->dd * o_ptr->ds / 5))) mult = mult * 7 / 2;
3064 /* Print the relevant lines */
3066 if (have_flag(flgs, TR_FORCE_WEAPON)) compare_weapon_aux2(o_ptr, blow, r++, col, 1*mult, "ÍýÎÏ:", TERM_L_BLUE);
3067 if (have_flag(flgs, TR_KILL_ANIMAL)) compare_weapon_aux2(o_ptr, blow, r++, col, 4*mult, "ưʪ:", TERM_YELLOW);
3068 else if (have_flag(flgs, TR_SLAY_ANIMAL)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "ưʪ:", TERM_YELLOW);
3069 if (have_flag(flgs, TR_KILL_EVIL)) compare_weapon_aux2(o_ptr, blow, r++, col, 7*mult/2, "¼Ù°:", TERM_YELLOW);
3070 else if (have_flag(flgs, TR_SLAY_EVIL)) compare_weapon_aux2(o_ptr, blow, r++, col, 2*mult, "¼Ù°:", TERM_YELLOW);
3071 if (have_flag(flgs, TR_KILL_HUMAN)) compare_weapon_aux2(o_ptr, blow, r++, col, 4*mult, "¿Í´Ö:", TERM_YELLOW);
3072 else if (have_flag(flgs, TR_SLAY_HUMAN)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "¿Í´Ö:", TERM_YELLOW);
3073 if (have_flag(flgs, TR_KILL_UNDEAD)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "ÉÔ»à:", TERM_YELLOW);
3074 else if (have_flag(flgs, TR_SLAY_UNDEAD)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "ÉÔ»à:", TERM_YELLOW);
3075 if (have_flag(flgs, TR_KILL_DEMON)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "°Ëâ:", TERM_YELLOW);
3076 else if (have_flag(flgs, TR_SLAY_DEMON)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "°Ëâ:", TERM_YELLOW);
3077 if (have_flag(flgs, TR_KILL_ORC)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "¥ª¡¼¥¯:", TERM_YELLOW);
3078 else if (have_flag(flgs, TR_SLAY_ORC)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "¥ª¡¼¥¯:", TERM_YELLOW);
3079 if (have_flag(flgs, TR_KILL_TROLL)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "¥È¥í¥ë:", TERM_YELLOW);
3080 else if (have_flag(flgs, TR_SLAY_TROLL)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "¥È¥í¥ë:", TERM_YELLOW);
3081 if (have_flag(flgs, TR_KILL_GIANT)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "µð¿Í:", TERM_YELLOW);
3082 else if (have_flag(flgs, TR_SLAY_GIANT)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "µð¿Í:", TERM_YELLOW);
3083 if (have_flag(flgs, TR_KILL_DRAGON)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "ε:", TERM_YELLOW);
3084 else if (have_flag(flgs, TR_SLAY_DRAGON)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "ε:", TERM_YELLOW);
3085 if (have_flag(flgs, TR_BRAND_ACID)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "»À°À:", TERM_RED);
3086 if (have_flag(flgs, TR_BRAND_ELEC)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "ÅÅ°À:", TERM_RED);
3087 if (have_flag(flgs, TR_BRAND_FIRE)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "±ê°À:", TERM_RED);
3088 if (have_flag(flgs, TR_BRAND_COLD)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "Îä°À:", TERM_RED);
3089 if (have_flag(flgs, TR_BRAND_POIS)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "ÆÇ°À:", TERM_RED);
3091 if (have_flag(flgs, TR_FORCE_WEAPON)) compare_weapon_aux2(o_ptr, blow, r++, col, 1*mult, "Force :", TERM_L_BLUE);
3092 if (have_flag(flgs, TR_KILL_ANIMAL)) compare_weapon_aux2(o_ptr, blow, r++, col, 4*mult, "Animals:", TERM_YELLOW);
3093 else if (have_flag(flgs, TR_SLAY_ANIMAL)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "Animals:", TERM_YELLOW);
3094 if (have_flag(flgs, TR_KILL_EVIL)) compare_weapon_aux2(o_ptr, blow, r++, col, 7*mult/2, "Evil:", TERM_YELLOW);
3095 else if (have_flag(flgs, TR_SLAY_EVIL)) compare_weapon_aux2(o_ptr, blow, r++, col, 2*mult, "Evil:", TERM_YELLOW);
3096 if (have_flag(flgs, TR_KILL_HUMAN)) compare_weapon_aux2(o_ptr, blow, r++, col, 4*mult, "Human:", TERM_YELLOW);
3097 else if (have_flag(flgs, TR_SLAY_HUMAN)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "Human:", TERM_YELLOW);
3098 if (have_flag(flgs, TR_KILL_UNDEAD)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "Undead:", TERM_YELLOW);
3099 else if (have_flag(flgs, TR_SLAY_UNDEAD)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "Undead:", TERM_YELLOW);
3100 if (have_flag(flgs, TR_KILL_DEMON)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "Demons:", TERM_YELLOW);
3101 else if (have_flag(flgs, TR_SLAY_DEMON)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "Demons:", TERM_YELLOW);
3102 if (have_flag(flgs, TR_KILL_ORC)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "Orcs:", TERM_YELLOW);
3103 else if (have_flag(flgs, TR_SLAY_ORC)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "Orcs:", TERM_YELLOW);
3104 if (have_flag(flgs, TR_KILL_TROLL)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "Trolls:", TERM_YELLOW);
3105 else if (have_flag(flgs, TR_SLAY_TROLL)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "Trolls:", TERM_YELLOW);
3106 if (have_flag(flgs, TR_KILL_GIANT)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "Giants:", TERM_YELLOW);
3107 else if (have_flag(flgs, TR_SLAY_GIANT)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "Giants:", TERM_YELLOW);
3108 if (have_flag(flgs, TR_KILL_DRAGON)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult, "Dragons:", TERM_YELLOW);
3109 else if (have_flag(flgs, TR_SLAY_DRAGON)) compare_weapon_aux2(o_ptr, blow, r++, col, 3*mult, "Dragons:", TERM_YELLOW);
3110 if (have_flag(flgs, TR_BRAND_ACID)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "Acid:", TERM_RED);
3111 if (have_flag(flgs, TR_BRAND_ELEC)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "Elec:", TERM_RED);
3112 if (have_flag(flgs, TR_BRAND_FIRE)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "Fire:", TERM_RED);
3113 if (have_flag(flgs, TR_BRAND_COLD)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "Cold:", TERM_RED);
3114 if (have_flag(flgs, TR_BRAND_POIS)) compare_weapon_aux2(o_ptr, blow, r++, col, 5*mult/2, "Poison:", TERM_RED);
3119 static int hit_chance(int to_h, int ac)
3122 int meichuu = p_ptr->skill_thn + (p_ptr->to_h[0] + to_h) * BTH_PLUS_ADJ;
3124 if (meichuu <= 0) return 5;
3126 chance = 100 - ((ac * 75) / meichuu);
3128 if (chance > 95) chance = 95;
3129 if (chance < 5) chance = 5;
3130 if (p_ptr->pseikaku == SEIKAKU_NAMAKE)
3131 chance = (chance*19+9)/20;
3136 * Displays all info about a weapon
3138 * Only accurate for the current weapon, because it includes
3139 * various info about the player's +to_dam and number of blows.
3141 static void list_weapon(object_type *o_ptr, int row, int col)
3143 char o_name[MAX_NLEN];
3146 /* Print the weapon name */
3147 object_desc(o_name, o_ptr, TRUE, 0);
3148 c_put_str(TERM_YELLOW, o_name, row, col);
3150 /* Print the player's number of blows */
3152 sprintf(tmp_str, "¹¶·â²ó¿ô: %d", p_ptr->num_blow[0]);
3154 sprintf(tmp_str, "Number of Blows: %d", p_ptr->num_blow[0]);
3157 put_str(tmp_str, row+1, col);
3159 /* Print to_hit and to_dam of the weapon */
3161 sprintf(tmp_str, "Ì¿ÃæΨ: 0 50 100 150 200 (Ũ¤ÎAC)");
3163 sprintf(tmp_str, "To Hit: 0 50 100 150 200 (AC)");
3166 put_str(tmp_str, row+2, col);
3168 /* Print the weapons base damage dice */
3170 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));
3172 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));
3175 put_str(tmp_str, row+3, col);
3178 c_put_str(TERM_YELLOW, "²Äǽ¤Ê¥À¥á¡¼¥¸:", row+5, col);
3180 c_put_str(TERM_YELLOW, "Possible Damage:", row+5, col);
3184 /* Damage for one blow (if it hits) */
3186 sprintf(tmp_str, "¹¶·â°ì²ó¤Ë¤Ä¤ %d-%d",
3188 sprintf(tmp_str, "One Strike: %d-%d damage",
3191 o_ptr->dd + o_ptr->to_d + p_ptr->to_d[0],
3192 o_ptr->ds * o_ptr->dd + o_ptr->to_d + p_ptr->to_d[0]);
3193 put_str(tmp_str, row+6, col+1);
3195 /* Damage for the complete attack (if all blows hit) */
3197 sprintf(tmp_str, "£±¥¿¡¼¥ó¤Ë¤Ä¤ %d-%d",
3199 sprintf(tmp_str, "One Attack: %d-%d damage",
3202 p_ptr->num_blow[0] * (o_ptr->dd + o_ptr->to_d + p_ptr->to_d[0]),
3203 p_ptr->num_blow[0] * (o_ptr->ds * o_ptr->dd + o_ptr->to_d + p_ptr->to_d[0]));
3204 put_str(tmp_str, row+7, col+1);
3209 * Hook to specify "weapon"
3211 static bool item_tester_hook_melee_weapon(object_type *o_ptr)
3213 switch (o_ptr->tval)
3223 if (o_ptr->sval != SV_DOKUBARI) return (TRUE);
3232 * Hook to specify "ammo"
3234 static bool item_tester_hook_ammo(object_type *o_ptr)
3236 switch (o_ptr->tval)
3253 * Copies the weapons to compare into the weapon-slot and
3254 * compares the values for both weapons.
3256 static bool compare_weapons(void)
3259 object_type *o1_ptr, *o2_ptr;
3260 object_type orig_weapon;
3266 /* Clear the screen */
3269 /* Store copy of original wielded weapon */
3270 i_ptr = &inventory[INVEN_RARM];
3271 object_copy(&orig_weapon, i_ptr);
3273 item_tester_no_ryoute = TRUE;
3274 /* Only compare melee weapons */
3275 item_tester_hook = item_tester_hook_melee_weapon;
3277 /* Get the first weapon */
3279 q = "Âè°ì¤ÎÉð´ï¤Ï¡©";
3280 s = "Èæ¤Ù¤ë¤â¤Î¤¬¤¢¤ê¤Þ¤»¤ó¡£";
3282 q = "What is your first weapon? ";
3283 s = "You have nothing to compare.";
3286 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN)))
3292 /* Get the item (in the pack) */
3293 o1_ptr = &inventory[item];
3295 /* Clear the screen */
3298 item_tester_no_ryoute = TRUE;
3299 /* Only compare melee weapons */
3300 item_tester_hook = item_tester_hook_melee_weapon;
3302 /* Get the second weapon */
3304 q = "ÂèÆó¤ÎÉð´ï¤Ï¡©";
3305 s = "Èæ¤Ù¤ë¤â¤Î¤¬¤¢¤ê¤Þ¤»¤ó¡£";
3307 q = "What is your second weapon? ";
3308 s = "You have nothing to compare.";
3311 if (!get_item(&item2, q, s, (USE_EQUIP | USE_INVEN)))
3317 /* Get the item (in the pack) */
3318 o2_ptr = &inventory[item2];
3320 /* Clear the screen */
3323 /* Copy first weapon into the weapon slot (if it's not already there) */
3324 if (o1_ptr != i_ptr)
3325 object_copy(i_ptr, o1_ptr);
3327 /* Get the new values */
3330 /* List the new values */
3331 list_weapon(o1_ptr, row, 2);
3332 compare_weapon_aux1(o1_ptr, 2, row + 8);
3334 /* Copy second weapon into the weapon slot (if it's not already there) */
3335 if (o2_ptr != i_ptr)
3336 object_copy(i_ptr, o2_ptr);
3338 object_copy(i_ptr, &orig_weapon);
3340 /* Get the new values */
3343 /* List the new values */
3344 list_weapon(o2_ptr, row, 40);
3345 compare_weapon_aux1(o2_ptr, 40, row + 8);
3347 /* Copy back the original weapon into the weapon slot */
3348 object_copy(i_ptr, &orig_weapon);
3350 /* Reset the values for the old weapon */
3354 put_str("(°ìÈֹ⤤¥À¥á¡¼¥¸¤¬Å¬ÍѤµ¤ì¤Þ¤¹¡£Ê£¿ô¤ÎÇÜÂǸú²Ì¤Ï¤·»»¤µ¤ì¤Þ¤»¤ó¡£)", row + 4, 0);
3356 put_str("(Only highest damage applies per monster. Special damage not cumulative.)", row + 4, 0);
3360 msg_print("¸½ºß¤Îµ»Î̤«¤éȽÃǤ¹¤ë¤È¡¢¤¢¤Ê¤¿¤ÎÉð´ï¤Ï°Ê²¼¤Î¤è¤¦¤Ê°ÒÎϤòȯ´ø¤·¤Þ¤¹:");
3362 msg_print("Based on your current abilities, here is what your weapons will do");
3378 * AC¤«¤é²óÈòΨ¡¢¥À¥á¡¼¥¸¸º¾¯Î¨¤ò·×»»¤·É½¼¨¤¹¤ë
3379 * Calculate and display the dodge-rate and the protection-rate
3382 static bool eval_ac(int iAC)
3386 "¥À¥á¡¼¥¸·Ú¸ºÎ¨¤È¤Ï¡¢Å¨¤Î¹¶·â¤¬Åö¤¿¤Ã¤¿»þ¤½¤Î¥À¥á¡¼¥¸¤ò\n"
3387 "²¿¥Ñ¡¼¥»¥ó¥È·Ú¸º¤¹¤ë¤«¤ò¼¨¤·¤Þ¤¹¡£\n"
3388 "¥À¥á¡¼¥¸·Ú¸º¤ÏÄ̾ï¤ÎľÀܹ¶·â(¼ïÎब¡Ö¹¶·â¤¹¤ë¡×¤È¡ÖÊ´ºÕ¤¹¤ë¡×¤Îʪ)\n"
3389 "¤ËÂФ·¤Æ¤Î¤ß¸ú²Ì¤¬¤¢¤ê¤Þ¤¹¡£\n \n"
3390 "Ũ¤Î¥ì¥Ù¥ë¤È¤Ï¡¢¤½¤ÎŨ¤¬Ä̾ﲿ³¬¤Ë¸½¤ì¤ë¤«¤ò¼¨¤·¤Þ¤¹¡£\n \n"
3391 "²óÈòΨ¤ÏŨ¤ÎľÀܹ¶·â¤ò²¿¥Ñ¡¼¥»¥ó¥È¤Î³ÎΨ¤ÇÈò¤±¤ë¤«¤ò¼¨¤·¡¢\n"
3392 "Ũ¤Î¥ì¥Ù¥ë¤È¤¢¤Ê¤¿¤ÎAC¤Ë¤è¤Ã¤Æ·èÄꤵ¤ì¤Þ¤¹¡£\n \n"
3393 "¥À¥á¡¼¥¸´üÂÔÃͤȤϡ¢Å¨¤Î£±£°£°¥Ý¥¤¥ó¥È¤ÎÄ̾ﹶ·â¤ËÂФ·¡¢\n"
3394 "²óÈòΨ¤È¥À¥á¡¼¥¸·Ú¸ºÎ¨¤ò¹Íθ¤·¤¿¥À¥á¡¼¥¸¤Î´üÂÔÃͤò¼¨¤·¤Þ¤¹¡£\n";
3397 "'Protection Rate' means how much damage is reduced by your armor.\n"
3398 "Note that the Protection rate is effective only against normal "
3399 "'attack' and 'shatter' type melee attacks, "
3400 "and has no effect against any other types such as 'poison'.\n \n"
3401 "'Dodge Rate' indicates the success rate on dodging the "
3402 "monster's melee attacks. "
3403 "It is depend on the level of the monster and your AC.\n \n"
3404 "'Average Damage' indicates the expected amount of damage "
3405 "when you are attacked by normal melee attacks with power=100.";
3411 char buf[80*20], *t;
3413 /* AC lower than zero has no effect */
3414 if (iAC < 0) iAC = 0;
3416 /* ¥À¥á¡¼¥¸·Ú¸ºÎ¨¤ò·×»» */
3417 protection = 100 * MIN(iAC, 150) / 250;
3423 put_str(format("¤¢¤Ê¤¿¤Î¸½ºß¤ÎAC: %3d", iAC), row++, 0);
3424 put_str(format("¥À¥á¡¼¥¸·Ú¸ºÎ¨ : %3d%%", protection), row++, 0);
3427 put_str("Ũ¤Î¥ì¥Ù¥ë :", row + 0, 0);
3428 put_str("²óÈòΨ :", row + 1, 0);
3429 put_str("¥À¥á¡¼¥¸´üÂÔÃÍ :", row + 2, 0);
3431 put_str(format("Your current AC : %3d", iAC), row++, 0);
3432 put_str(format("Protection rate : %3d%%", protection), row++, 0);
3435 put_str("Level of Monster:", row + 0, 0);
3436 put_str("Dodge Rate :", row + 1, 0);
3437 put_str("Average Damage :", row + 2, 0);
3440 for (col = 17 + 1, lvl = 0; lvl <= 100; lvl += 10, col += 5)
3442 int quality = 60 + lvl * 3; /* attack quality with power 60 */
3443 int dodge; /* ²óÈòΨ(%) */
3444 int average; /* ¥À¥á¡¼¥¸´üÂÔÃÍ */
3446 put_str(format("%3d", lvl), row + 0, col);
3449 dodge = 5 + (MIN(100, 100 * (iAC * 3 / 4) / quality) * 9 + 5) / 10;
3450 put_str(format("%3d%%", dodge), row + 1, col);
3452 /* 100ÅÀ¤Î¹¶·â¤ËÂФ·¤Æ¤Î¥À¥á¡¼¥¸´üÂÔÃͤò·×»» */
3453 average = (100 - dodge) * (100 - protection) / 100;
3454 put_str(format("%3d", average), row + 2, col);
3458 roff_to_buf(memo, 70, buf, sizeof(buf));
3459 for (t = buf; t[0]; t += strlen(t) + 1)
3460 put_str(t, (row++) + 4, 4);
3463 prt("¸½ºß¤Î¤¢¤Ê¤¿¤ÎÁõÈ÷¤«¤é¤¹¤ë¤È¡¢¤¢¤Ê¤¿¤ÎËɸæÎϤÏ"
3464 "¤³¤ì¤¯¤é¤¤¤Ç¤¹:", 0, 0);
3466 prt("Defense abilities from your current Armor Class are evaluated below.", 0, 0);
3481 static bool enchant_item(int cost, int to_hit, int to_dam, int to_ac)
3487 int maxenchant = (p_ptr->lev / 5);
3488 char tmp_str[MAX_NLEN];
3493 prt(format("¸½ºß¤Î¤¢¤Ê¤¿¤Îµ»Î̤À¤È¡¢+%d ¤Þ¤Ç²þÎɤǤ¤Þ¤¹¡£", maxenchant), 5, 0);
3494 prt(format(" ²þÎɤÎÎÁ¶â¤Ï°ì¸Ä¤Ë¤Ä¤¡ð%d ¤Ç¤¹¡£", cost), 7, 0);
3496 prt(format(" Based on your skill, we can improve up to +%d.", maxenchant), 5, 0);
3497 prt(format(" The price for the service is %d gold per item.", cost), 7, 0);
3500 item_tester_no_ryoute = TRUE;
3504 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò²þÎɤ·¤Þ¤¹¤«¡©";
3505 s = "²þÎɤǤ¤ë¤â¤Î¤¬¤¢¤ê¤Þ¤»¤ó¡£";
3507 q = "Improve which item? ";
3508 s = "You have nothing to improve.";
3511 if (!get_item(&item, q, s, (USE_INVEN | USE_EQUIP))) return (FALSE);
3513 /* Get the item (in the pack) */
3514 o_ptr = &inventory[item];
3516 /* Check if the player has enough money */
3517 if (p_ptr->au < (cost * o_ptr->number))
3519 object_desc(tmp_str, o_ptr, TRUE, 0);
3521 msg_format("%s¤ò²þÎɤ¹¤ë¤À¤±¤Î¥´¡¼¥ë¥É¤¬¤¢¤ê¤Þ¤»¤ó¡ª", tmp_str);
3523 msg_format("You do not have the gold to improve %s!", tmp_str);
3529 /* Enchant to hit */
3530 for (i = 0; i < to_hit; i++)
3532 if (o_ptr->to_h < maxenchant)
3534 if (enchant(o_ptr, 1, (ENCH_TOHIT | ENCH_FORCE)))
3542 /* Enchant to damage */
3543 for (i = 0; i < to_dam; i++)
3545 if (o_ptr->to_d < maxenchant)
3547 if (enchant(o_ptr, 1, (ENCH_TODAM | ENCH_FORCE)))
3556 for (i = 0; i < to_ac; i++)
3558 if (o_ptr->to_a < maxenchant)
3560 if (enchant(o_ptr, 1, (ENCH_TOAC | ENCH_FORCE)))
3572 if (flush_failure) flush();
3576 msg_print("²þÎɤ˼ºÇÔ¤·¤¿¡£");
3578 msg_print("The improvement failed.");
3586 object_desc(tmp_str, o_ptr, TRUE, 1);
3588 msg_format("¡ð%d ¤Ç%s¤ò²þÎɤ·¤Þ¤·¤¿¡£", cost * o_ptr->number, tmp_str );
3590 msg_format("Improved %s for %d gold.", tmp_str, cost * o_ptr->number);
3593 /* Charge the money */
3594 p_ptr->au -= (cost * o_ptr->number);
3596 if (item >= INVEN_RARM) calc_android_exp();
3598 /* Something happened */
3605 * Recharge rods, wands and staves
3607 * The player can select the number of charges to add
3608 * (up to a limit), and the recharge never fails.
3610 * The cost for rods depends on the level of the rod. The prices
3611 * for recharging wands and staves are dependent on the cost of
3614 static void building_recharge(void)
3623 char tmp_str[MAX_NLEN];
3627 /* Display some info */
3630 prt(" ºÆ½¼Å¶¤ÎÈñÍѤϥ¢¥¤¥Æ¥à¤Î¼ïÎà¤Ë¤è¤ê¤Þ¤¹¡£", 6, 0);
3632 prt(" The prices of recharge depend on the type.", 6, 0);
3636 /* Only accept legal items */
3637 item_tester_hook = item_tester_hook_recharge;
3641 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ËËâÎϤò½¼Å¶¤·¤Þ¤¹¤«? ";
3642 s = "ËâÎϤò½¼Å¶¤¹¤Ù¤¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡£";
3644 q = "Recharge which item? ";
3645 s = "You have nothing to recharge.";
3648 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
3650 /* Get the item (in the pack) */
3653 o_ptr = &inventory[item];
3656 /* Get the item (on the floor) */
3659 o_ptr = &o_list[0 - item];
3662 k_ptr = &k_info[o_ptr->k_idx];
3665 * We don't want to give the player free info about
3666 * the level of the item or the number of charges.
3668 /* The item must be "known" */
3669 if (!object_known_p(o_ptr))
3672 msg_format("½¼Å¶¤¹¤ëÁ°¤Ë´ÕÄꤵ¤ì¤Æ¤¤¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡ª");
3674 msg_format("The item must be identified first!");
3679 if ((p_ptr->au >= 50) &&
3681 get_check("¡ð50¤Ç´ÕÄꤷ¤Þ¤¹¤«¡© "))
3683 get_check("Identify for 50 gold? "))
3691 identify_item(o_ptr);
3694 object_desc(tmp_str, o_ptr, TRUE, 3);
3697 msg_format("%s ¤Ç¤¹¡£", tmp_str);
3699 msg_format("You have: %s.", tmp_str);
3703 /* Update the gold display */
3704 building_prt_gold();
3712 /* Extract the object "level" */
3713 lev = get_object_level(o_ptr);
3715 /* Price for a rod */
3716 if (o_ptr->tval == TV_ROD)
3718 if (o_ptr->timeout > 0)
3720 /* Fully recharge */
3721 price = (lev * 50 * o_ptr->timeout) / k_ptr->pval;
3725 /* No recharge necessary */
3728 msg_format("¤½¤ì¤ÏºÆ½¼Å¶¤¹¤ëɬÍפϤ¢¤ê¤Þ¤»¤ó¡£");
3730 msg_format("That doesn't need to be recharged.");
3736 else if (o_ptr->tval == TV_STAFF)
3738 /* Price per charge ( = double the price paid by shopkeepers for the charge) */
3739 price = (get_object_cost(o_ptr) / 10) * o_ptr->number;
3741 /* Pay at least 10 gold per charge */
3742 price = MAX(10, price);
3746 /* Price per charge ( = double the price paid by shopkeepers for the charge) */
3747 price = (get_object_cost(o_ptr) / 10);
3749 /* Pay at least 10 gold per charge */
3750 price = MAX(10, price);
3753 /* Limit the number of charges for wands and staffs */
3754 if (o_ptr->tval == TV_WAND
3755 && (o_ptr->pval / o_ptr->number >= k_ptr->pval))
3757 if (o_ptr->number > 1)
3760 msg_print("¤³¤ÎËâË¡ËÀ¤Ï¤â¤¦½¼Ê¬¤Ë½¼Å¶¤µ¤ì¤Æ¤¤¤Þ¤¹¡£");
3762 msg_print("These wands are already fully charged.");
3768 msg_print("¤³¤ÎËâË¡ËÀ¤Ï¤â¤¦½¼Ê¬¤Ë½¼Å¶¤µ¤ì¤Æ¤¤¤Þ¤¹¡£");
3770 msg_print("This wand is already fully charged.");
3775 else if (o_ptr->tval == TV_STAFF && o_ptr->pval >= k_ptr->pval)
3777 if (o_ptr->number > 1)
3780 msg_print("¤³¤Î¾ó¤Ï¤â¤¦½¼Ê¬¤Ë½¼Å¶¤µ¤ì¤Æ¤¤¤Þ¤¹¡£");
3782 msg_print("These staffs are already fully charged.");
3788 msg_print("¤³¤Î¾ó¤Ï¤â¤¦½¼Ê¬¤Ë½¼Å¶¤µ¤ì¤Æ¤¤¤Þ¤¹¡£");
3790 msg_print("This staff is already fully charged.");
3796 /* Check if the player has enough money */
3797 if (p_ptr->au < price)
3799 object_desc(tmp_str, o_ptr, TRUE, 0);
3801 msg_format("%s¤òºÆ½¼Å¶¤¹¤ë¤Ë¤Ï¡ð%d ɬÍפǤ¹¡ª", tmp_str,price );
3803 msg_format("You need %d gold to recharge %s!", price, tmp_str);
3809 if (o_ptr->tval == TV_ROD)
3812 if (get_check(format("¤½¤Î¥í¥Ã¥É¤ò¡ð%d ¤ÇºÆ½¼Å¶¤·¤Þ¤¹¤«¡©",
3815 if (get_check(format("Recharge the %s for %d gold? ",
3816 ((o_ptr->number > 1) ? "rods" : "rod"), price)))
3820 /* Recharge fully */
3830 if (o_ptr->tval == TV_STAFF)
3831 max_charges = k_ptr->pval - o_ptr->pval;
3833 max_charges = o_ptr->number * k_ptr->pval - o_ptr->pval;
3835 /* Get the quantity for staves and wands */
3837 charges = get_quantity(format("°ì²óʬ¡ð%d ¤Ç²¿²óʬ½¼Å¶¤·¤Þ¤¹¤«¡©",
3839 charges = get_quantity(format("Add how many charges for %d gold? ",
3842 price), MIN(p_ptr->au / price, max_charges));
3845 if (charges < 1) return;
3847 /* Get the new price */
3851 o_ptr->pval += charges;
3853 /* We no longer think the item is empty */
3854 o_ptr->ident &= ~(IDENT_EMPTY);
3858 object_desc(tmp_str, o_ptr, TRUE, 3);
3860 msg_format("%s¤ò¡ð%d ¤ÇºÆ½¼Å¶¤·¤Þ¤·¤¿¡£", tmp_str, price);
3862 msg_format("%^s %s recharged for %d gold.", tmp_str, ((o_ptr->number > 1) ? "were" : "was"), price);
3865 /* Combine / Reorder the pack (later) */
3866 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
3869 p_ptr->window |= (PW_INVEN);
3880 * Recharge rods, wands and staves
3882 * The player can select the number of charges to add
3883 * (up to a limit), and the recharge never fails.
3885 * The cost for rods depends on the level of the rod. The prices
3886 * for recharging wands and staves are dependent on the cost of
3889 static void building_recharge_all(void)
3899 /* Display some info */
3903 prt(" ºÆ½¼Å¶¤ÎÈñÍѤϥ¢¥¤¥Æ¥à¤Î¼ïÎà¤Ë¤è¤ê¤Þ¤¹¡£", 6, 0);
3905 prt(" The prices of recharge depend on the type.", 6, 0);
3908 /* Calculate cost */
3909 for ( i = 0; i < INVEN_PACK; i++)
3911 o_ptr = &inventory[i];
3913 /* skip non magic device */
3914 if (o_ptr->tval < TV_STAFF || o_ptr->tval > TV_ROD) continue;
3916 /* need identified */
3917 if (!object_known_p(o_ptr)) total_cost += 50;
3919 /* Extract the object "level" */
3920 lev = get_object_level(o_ptr);
3922 k_ptr = &k_info[o_ptr->k_idx];
3924 switch (o_ptr->tval)
3927 price = (lev * 50 * o_ptr->timeout) / k_ptr->pval;
3931 /* Price per charge ( = double the price paid by shopkeepers for the charge) */
3932 price = (get_object_cost(o_ptr) / 10) * o_ptr->number;
3934 /* Pay at least 10 gold per charge */
3935 price = MAX(10, price);
3938 price = (k_ptr->pval - o_ptr->pval) * price;
3942 /* Price per charge ( = double the price paid by shopkeepers for the charge) */
3943 price = (get_object_cost(o_ptr) / 10);
3945 /* Pay at least 10 gold per charge */
3946 price = MAX(10, price);
3949 price = (o_ptr->number * k_ptr->pval - o_ptr->pval) * price;
3953 /* if price <= 0 then item have enough charge */
3954 if (price > 0) total_cost += price;
3960 msg_print("½¼Å¶¤¹¤ëɬÍפϤ¢¤ê¤Þ¤»¤ó¡£");
3962 msg_print("No need to recharge.");
3969 /* Check if the player has enough money */
3970 if (p_ptr->au < total_cost)
3973 msg_format("¤¹¤Ù¤Æ¤Î¥¢¥¤¥Æ¥à¤òºÆ½¼Å¶¤¹¤ë¤Ë¤Ï¡ð%d ɬÍפǤ¹¡ª", total_cost );
3975 msg_format("You need %d gold to recharge all items!",total_cost);
3983 if (!get_check(format("¤¹¤Ù¤Æ¤Î¥¢¥¤¥Æ¥à¤ò ¡ð%d ¤ÇºÆ½¼Å¶¤·¤Þ¤¹¤«¡©", total_cost))) return;
3985 if (!get_check(format("Recharge all items for %d gold? ", total_cost))) return;
3988 for (i = 0; i < INVEN_PACK; i++)
3990 o_ptr = &inventory[i];
3991 k_ptr = &k_info[o_ptr->k_idx];
3993 /* skip non magic device */
3994 if (o_ptr->tval < TV_STAFF || o_ptr->tval > TV_ROD) continue;
3997 if (!object_known_p(o_ptr)) identify_item(o_ptr);
4000 switch (o_ptr->tval)
4006 if (o_ptr->pval < k_ptr->pval) o_ptr->pval = k_ptr->pval;
4007 /* We no longer think the item is empty */
4008 o_ptr->ident &= ~(IDENT_EMPTY);
4011 if (o_ptr->pval < o_ptr->number * k_ptr->pval)
4012 o_ptr->pval = o_ptr->number * k_ptr->pval;
4013 /* We no longer think the item is empty */
4014 o_ptr->ident &= ~(IDENT_EMPTY);
4021 msg_format("¡ð%d ¤ÇºÆ½¼Å¶¤·¤Þ¤·¤¿¡£", total_cost);
4023 msg_format("You pay %d gold.", total_cost);
4028 /* Combine / Reorder the pack (later) */
4029 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
4032 p_ptr->window |= (PW_INVEN);
4035 p_ptr->au -= total_cost;
4042 bool tele_town(void)
4050 msg_print("¤³¤ÎËâË¡¤ÏÃϾå¤Ç¤·¤«»È¤¨¤Ê¤¤¡ª");
4052 msg_print("This spell can only be used on the surface!");
4057 if (p_ptr->inside_arena || p_ptr->inside_battle)
4060 msg_print("¤³¤ÎËâË¡¤Ï³°¤Ç¤·¤«»È¤¨¤Ê¤¤¡ª");
4062 msg_print("This spell can only be used outside!");
4070 for (i=1;i<max_towns;i++)
4074 if ((i == NO_TOWN) || (i == SECRET_TOWN) || (i == p_ptr->town_num) || !(p_ptr->visit & (1L << (i-1)))) continue;
4076 sprintf(buf,"%c) %-20s", I2A(i-1), town[i].name);
4084 msg_print("¤Þ¤À¹Ô¤±¤ë¤È¤³¤í¤¬¤Ê¤¤¡£");
4086 msg_print("You have not yet visited any town.");
4095 prt("¤É¤³¤Ë¹Ô¤¤Þ¤¹¤«:", 0, 0);
4097 prt("Which town you go: ", 0, 0);
4108 else if ((i < 'a') || (i > ('a'+max_towns-2))) continue;
4109 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;
4113 for (y = 0; y < max_wild_y; y++)
4115 for (x = 0; x < max_wild_x; x++)
4117 if(wilderness[y][x].town == (i-'a'+1))
4119 p_ptr->wilderness_y = y;
4120 p_ptr->wilderness_x = x;
4124 p_ptr->leftbldg = TRUE;
4125 p_ptr->leaving = TRUE;
4127 p_ptr->teleport_town = TRUE;
4137 static bool research_mon(void)
4145 bool recall = FALSE;
4151 /* XTRA HACK WHATSEARCH */
4157 /* XTRA HACK REMEMBER_IDX */
4158 static int old_sym = '\0';
4159 static int old_i = 0;
4162 /* Save the screen */
4165 /* Get a character, or abort */
4167 if (!get_com("¥â¥ó¥¹¥¿¡¼¤Îʸ»ú¤òÆþÎϤ·¤Æ²¼¤µ¤¤(µ¹æ or ^AÁ´,^U¥æ,^NÈó¥æ,^M̾Á°):", &sym, FALSE))
4169 if (!get_com("Enter character to be identified(^A:All,^U:Uniqs,^N:Non uniqs,^M:Name): ", &sym, FALSE))
4179 /* Find that character info, and describe it */
4180 for (i = 0; ident_info[i]; ++i)
4182 if (sym == ident_info[i][0]) break;
4185 /* XTRA HACK WHATSEARCH */
4186 if (sym == KTRL('A'))
4190 strcpy(buf, "Á´¥â¥ó¥¹¥¿¡¼¤Î¥ê¥¹¥È");
4192 strcpy(buf, "Full monster list.");
4195 else if (sym == KTRL('U'))
4199 strcpy(buf, "¥æ¥Ë¡¼¥¯¡¦¥â¥ó¥¹¥¿¡¼¤Î¥ê¥¹¥È");
4201 strcpy(buf, "Unique monster list.");
4204 else if (sym == KTRL('N'))
4208 strcpy(buf, "¥æ¥Ë¡¼¥¯³°¥â¥ó¥¹¥¿¡¼¤Î¥ê¥¹¥È");
4210 strcpy(buf, "Non-unique monster list.");
4213 else if (sym == KTRL('M'))
4217 if (!get_string("̾Á°(±Ñ¸ì¤Î¾ì¹ç¾®Ê¸»ú¤Ç²Ä)",temp, 70))
4219 if (!get_string("Enter name:",temp, 70))
4230 sprintf(buf, "̾Á°:%s¤Ë¥Þ¥Ã¥Á",temp);
4232 sprintf(buf, "Monsters with a name \"%s\"",temp);
4235 else if (ident_info[i])
4237 sprintf(buf, "%c - %s.", sym, ident_info[i] + 2);
4242 sprintf(buf, "%c - %s", sym, "̵¸ú¤Êʸ»ú");
4244 sprintf(buf, "%c - %s.", sym, "Unknown Symbol");
4249 /* Display the result */
4253 /* Allocate the "who" array */
4254 C_MAKE(who, max_r_idx, u16b);
4256 /* Collect matching monsters */
4257 for (n = 0, i = 1; i < max_r_idx; i++)
4259 monster_race *r_ptr = &r_info[i];
4262 if (!r_ptr->name) continue;
4264 /* XTRA HACK WHATSEARCH */
4265 /* Require non-unique monsters if needed */
4266 if (norm && (r_ptr->flags1 & (RF1_UNIQUE))) continue;
4268 /* Require unique monsters if needed */
4269 if (uniq && !(r_ptr->flags1 & (RF1_UNIQUE))) continue;
4277 for (xx = 0; temp[xx] && xx < 80; xx++)
4280 if (iskanji(temp[xx]))
4286 if (isupper(temp[xx])) temp[xx] = tolower(temp[xx]);
4290 strcpy(temp2, r_name + r_ptr->E_name);
4292 strcpy(temp2, r_name + r_ptr->name);
4294 for (xx = 0; temp2[xx] && xx < 80; xx++)
4295 if (isupper(temp2[xx])) temp2[xx] = tolower(temp2[xx]);
4298 if (strstr(temp2, temp) || strstr_j(r_name + r_ptr->name, temp))
4300 if (strstr(temp2, temp))
4304 else if (all || (r_ptr->d_char == sym)) who[n++] = i;
4307 /* Nothing to recall */
4310 /* Free the "who" array */
4311 C_KILL(who, max_r_idx, u16b);
4323 /* Sort if needed */
4326 /* Select the sort method */
4327 ang_sort_comp = ang_sort_comp_hook;
4328 ang_sort_swap = ang_sort_swap_hook;
4330 /* Sort the array */
4331 ang_sort(who, &why, n);
4335 /* Start at the end */
4336 /* XTRA HACK REMEMBER_IDX */
4337 if (old_sym == sym && old_i < n) i = old_i;
4342 /* Scan the monster memory */
4345 /* Extract a race */
4348 /* Hack -- Begin the prompt */
4351 /* Hack -- Complete the prompt */
4353 Term_addstr(-1, TERM_WHITE, " ['r'»×¤¤½Ð, ' '¤Ç³¹Ô, ESC]");
4355 Term_addstr(-1, TERM_WHITE, " [(r)ecall, ESC, space to continue]");
4365 /*** Recall on screen ***/
4367 /* Get maximal info about this monster */
4368 lore_do_probe(r_idx);
4370 /* Save this monster ID */
4371 monster_race_track(r_idx);
4373 /* Hack -- Handle stuff */
4376 /* know every thing mode */
4377 screen_roff(r_idx, 0x01);
4380 /* XTRA HACK REMEMBER_IDX */
4388 /* Normal commands */
4389 if (query != 'r') break;
4396 if (query == ESCAPE) break;
4398 /* Move to "prev" monster */
4404 if (!expand_list) break;
4408 /* Move to "next" monster */
4414 if (!expand_list) break;
4420 /* Re-display the identity */
4421 /* prt(buf, 5, 5);*/
4423 /* Free the "who" array */
4424 C_KILL(who, max_r_idx, u16b);
4429 return (!notpicked);
4434 * Execute a building command
4436 static void bldg_process_command(building_type *bldg, int i)
4438 int bact = bldg->actions[i];
4443 /* Flush messages XXX XXX XXX */
4448 bcost = bldg->member_costs[i];
4450 bcost = bldg->other_costs[i];
4452 /* action restrictions */
4453 if (((bldg->action_restr[i] == 1) && !is_member(bldg)) ||
4454 ((bldg->action_restr[i] == 2) && !is_owner(bldg)))
4457 msg_print("¤½¤ì¤òÁªÂò¤¹¤ë¸¢Íø¤Ï¤¢¤ê¤Þ¤»¤ó¡ª");
4459 msg_print("You have no right to choose that!");
4464 /* check gold (HACK - Recharge uses variable costs) */
4465 if ((bact != BACT_RECHARGE) &&
4466 (((bldg->member_costs[i] > p_ptr->au) && is_owner(bldg)) ||
4467 ((bldg->other_costs[i] > p_ptr->au) && !is_owner(bldg))))
4470 msg_print("¤ª¶â¤¬Â¤ê¤Þ¤»¤ó¡ª");
4472 msg_print("You do not have the gold!");
4482 case BACT_RESEARCH_ITEM:
4483 paid = identify_fully(FALSE);
4485 case BACT_TOWN_HISTORY:
4488 case BACT_RACE_LEGENDS:
4494 case BACT_KING_LEGENDS:
4495 case BACT_ARENA_LEGENDS:
4500 case BACT_ARENA_RULES:
4504 case BACT_IN_BETWEEN:
4506 case BACT_SPIN_WHEEL:
4507 case BACT_DICE_SLOTS:
4508 case BACT_GAMBLE_RULES:
4515 paid = inn_comm(bact);
4517 case BACT_RESEARCH_MONSTER:
4518 paid = research_mon();
4520 case BACT_COMPARE_WEAPONS:
4521 paid = compare_weapons();
4523 case BACT_ENCHANT_WEAPON:
4524 item_tester_hook = item_tester_hook_melee_weapon;
4525 enchant_item(bcost, 1, 1, 0);
4527 case BACT_ENCHANT_ARMOR:
4528 item_tester_hook = item_tester_hook_armour;
4529 enchant_item(bcost, 0, 0, 1);
4532 building_recharge();
4534 case BACT_RECHARGE_ALL:
4535 building_recharge_all();
4537 case BACT_IDENTS: /* needs work */
4539 if (!get_check("»ý¤Áʪ¤òÁ´¤Æ´ÕÄꤷ¤Æ¤è¤í¤·¤¤¤Ç¤¹¤«¡©")) break;
4541 msg_print(" »ý¤ÁʪÁ´¤Æ¤¬´ÕÄꤵ¤ì¤Þ¤·¤¿¡£");
4543 if (!get_check("Do you pay for identify all your possession? ")) break;
4545 msg_print("Your possessions have been identified.");
4550 case BACT_IDENT_ONE: /* needs work */
4551 paid = ident_spell(FALSE);
4556 case BACT_HEALING: /* needs work */
4565 case BACT_RESTORE: /* needs work */
4566 if (do_res_stat(A_STR)) paid = TRUE;
4567 if (do_res_stat(A_INT)) paid = TRUE;
4568 if (do_res_stat(A_WIS)) paid = TRUE;
4569 if (do_res_stat(A_DEX)) paid = TRUE;
4570 if (do_res_stat(A_CON)) paid = TRUE;
4571 if (do_res_stat(A_CHR)) paid = TRUE;
4573 case BACT_GOLD: /* set timed reward flag */
4574 if (!p_ptr->rewards[BACT_GOLD])
4577 p_ptr->rewards[BACT_GOLD] = TRUE;
4582 msg_print("º£Æü¤Îʬ¤±Á°¤Ï¤¹¤Ç¤Ë»Ùʧ¤Ã¤¿¤¾¡ª");
4584 msg_print("You just had your daily allowance!");
4588 case BACT_ENCHANT_ARROWS:
4589 item_tester_hook = item_tester_hook_ammo;
4590 enchant_item(bcost, 1, 1, 0);
4592 case BACT_ENCHANT_BOW:
4593 item_tester_tval = TV_BOW;
4594 enchant_item(bcost, 1, 1, 0);
4597 if (recall_player(1)) paid = TRUE;
4599 case BACT_TELEPORT_LEVEL:
4606 /* Allocate the "dun" array */
4607 C_MAKE(dun, max_d_idx, s16b);
4612 for(i = 1; i < max_d_idx; i++)
4617 if (!d_info[i].maxdepth) continue;
4618 if (!max_dlv[i]) continue;
4619 if (d_info[i].final_guardian)
4621 if (!r_info[d_info[i].final_guardian].max_num) seiha = TRUE;
4623 else if (max_dlv[i] == d_info[i].maxdepth) seiha = TRUE;
4626 sprintf(buf,"%c) %c%-12s : ºÇÂç %d ³¬", 'a'+num, seiha ? '!' : ' ', d_name + d_info[i].name, max_dlv[i]);
4628 sprintf(buf,"%c) %c%-12s : Max level %d", 'a'+num, seiha ? '!' : ' ', d_name + d_info[i].name, max_dlv[i]);
4630 put_str(buf, 4+num, 5);
4635 prt("¤É¤Î¥À¥ó¥¸¥ç¥ó¤Ë¥Æ¥ì¥Ý¡¼¥È¤·¤Þ¤¹¤«:", 0, 0);
4637 prt("Which dungeon do you teleport?: ", 0, 0);
4645 /* Free the "dun" array */
4646 C_KILL(dun, max_d_idx, s16b);
4651 if (i >= 'a' && i <('a'+num))
4653 select_dungeon = dun[i-'a'];
4660 /* Free the "dun" array */
4661 C_KILL(dun, max_d_idx, s16b);
4663 max_depth = d_info[select_dungeon].maxdepth;
4665 /* Limit depth in Angband */
4666 if (select_dungeon == DUNGEON_ANGBAND)
4668 if (quest[QUEST_OBERON].status != QUEST_STATUS_FINISHED) max_depth = 98;
4669 else if(quest[QUEST_SERPENT].status != QUEST_STATUS_FINISHED) max_depth = 99;
4673 amt = get_quantity(format("%s¤Î²¿³¬¤Ë¥Æ¥ì¥Ý¡¼¥È¤·¤Þ¤¹¤«¡©", d_name + d_info[select_dungeon].name), max_depth);
4675 amt = get_quantity(format("Teleport to which level of %s? ", d_name + d_info[select_dungeon].name), max_depth);
4680 p_ptr->word_recall = 1;
4681 p_ptr->recall_dungeon = select_dungeon;
4682 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));
4683 if (record_maxdeapth)
4685 do_cmd_write_nikki(NIKKI_TRUMP, select_dungeon, "¥È¥é¥ó¥×¥¿¥ï¡¼¤Ç");
4687 do_cmd_write_nikki(NIKKI_TRUMP, select_dungeon, "at Trump Tower");
4690 msg_print("²ó¤ê¤ÎÂ絤¤¬Ä¥¤ê¤Ä¤á¤Æ¤¤¿...");
4692 msg_print("The air about you becomes charged...");
4696 p_ptr->redraw |= (PR_STATUS);
4700 case BACT_LOSE_MUTATION:
4701 if (p_ptr->muta1 || p_ptr->muta2 || p_ptr->muta3)
4703 while(!lose_mutation(0));
4709 msg_print("¼£¤¹¤Ù¤ÆÍÁ³ÊÑ°Û¤¬Ìµ¤¤¡£");
4711 msg_print("You have no mutations.");
4719 case BACT_TSUCHINOKO:
4733 msg_print("Ê¿¹Õ²½¤Îµ·¼°¤ò¹Ô¤Ê¤Ã¤¿¡£");
4735 msg_print("You received an equalization ritual.");
4737 set_virtue(V_COMPASSION, 0);
4738 set_virtue(V_HONOUR, 0);
4739 set_virtue(V_JUSTICE, 0);
4740 set_virtue(V_SACRIFICE, 0);
4741 set_virtue(V_KNOWLEDGE, 0);
4742 set_virtue(V_FAITH, 0);
4743 set_virtue(V_ENLIGHTEN, 0);
4744 set_virtue(V_ENCHANT, 0);
4745 set_virtue(V_CHANCE, 0);
4746 set_virtue(V_NATURE, 0);
4747 set_virtue(V_HARMONY, 0);
4748 set_virtue(V_VITALITY, 0);
4749 set_virtue(V_UNLIFE, 0);
4750 set_virtue(V_PATIENCE, 0);
4751 set_virtue(V_TEMPERANCE, 0);
4752 set_virtue(V_DILIGENCE, 0);
4753 set_virtue(V_VALOUR, 0);
4754 set_virtue(V_INDIVIDUALISM, 0);
4758 case BACT_TELE_TOWN:
4762 paid = eval_ac(p_ptr->dis_ac + p_ptr->dis_to_a);
4776 void do_cmd_quest(void)
4780 if (cave[py][px].feat != FEAT_QUEST_ENTER)
4783 msg_print("¤³¤³¤Ë¤Ï¥¯¥¨¥¹¥È¤ÎÆþ¸ý¤Ï¤Ê¤¤¡£");
4785 msg_print("You see no quest level here.");
4793 msg_print("¤³¤³¤Ë¤Ï¥¯¥¨¥¹¥È¤Ø¤ÎÆþ¸ý¤¬¤¢¤ê¤Þ¤¹¡£");
4794 if (!get_check("¥¯¥¨¥¹¥È¤ËÆþ¤ê¤Þ¤¹¤«¡©")) return;
4795 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
4796 msg_print("¡Ø¤È¤Ë¤«¤¯Æþ¤Ã¤Æ¤ß¤è¤¦¤¼¤§¡£¡Ù");
4798 msg_print("There is an entry of a quest.");
4799 if (!get_check("Do you enter? ")) return;
4802 /* Player enters a new quest */
4806 leave_quest_check();
4808 p_ptr->inside_quest = cave[py][px].special;
4809 if(quest[leaving_quest].type != QUEST_TYPE_RANDOM) dun_level = 1;
4810 p_ptr->leftbldg = TRUE;
4811 p_ptr->leaving = TRUE;
4817 * Do building commands
4819 void do_cmd_bldg(void)
4824 building_type *bldg;
4829 if (!((cave[py][px].feat >= FEAT_BLDG_HEAD) &&
4830 (cave[py][px].feat <= FEAT_BLDG_TAIL)))
4833 msg_print("¤³¤³¤Ë¤Ï·úʪ¤Ï¤Ê¤¤¡£");
4835 msg_print("You see no building here.");
4841 which = (cave[py][px].feat - FEAT_BLDG_HEAD);
4842 building_loc = which;
4844 bldg = &building[which];
4846 /* Don't re-init the wilderness */
4847 reinit_wilderness = FALSE;
4849 if ((which == 2) && (p_ptr->arena_number == 99))
4852 msg_print("¡ÖÇÔ¼Ô¤ËÍѤϤʤ¤¡£¡×");
4854 msg_print("'There's no place here for a LOSER like you!'");
4858 else if ((which == 2) && p_ptr->inside_arena && !p_ptr->exit_bldg)
4861 prt("¥²¡¼¥È¤ÏÊĤޤäƤ¤¤ë¡£¥â¥ó¥¹¥¿¡¼¤¬¤¢¤Ê¤¿¤òÂԤäƤ¤¤ë¡ª",0,0);
4863 prt("The gates are closed. The monster awaits!", 0, 0);
4868 else if ((which == 2) && p_ptr->inside_arena)
4870 p_ptr->leaving = TRUE;
4871 p_ptr->inside_arena = FALSE;
4873 else if (p_ptr->inside_battle)
4875 p_ptr->leaving = TRUE;
4876 p_ptr->inside_battle = FALSE;
4884 /* Forget the lite */
4887 /* Forget the view */
4890 /* Hack -- Increase "icky" depth */
4897 show_building(bldg);
4905 building_prt_gold();
4909 if (command == ESCAPE)
4912 p_ptr->inside_arena = FALSE;
4913 p_ptr->inside_battle = FALSE;
4917 for (i = 0; i < 8; i++)
4919 if (bldg->letters[i])
4921 if (bldg->letters[i] == command)
4930 bldg_process_command(bldg, i);
4939 /* Flush messages XXX XXX XXX */
4943 /* Reinit wilderness to activate quests ... */
4944 if (reinit_wilderness)
4945 p_ptr->leaving = TRUE;
4947 /* Hack -- Decrease "icky" depth */
4950 /* Clear the screen */
4953 /* Update the visuals */
4954 p_ptr->update |= (PU_VIEW | PU_MONSTERS | PU_BONUS | PU_LITE | PU_MON_LITE);
4956 /* Redraw entire screen */
4957 p_ptr->redraw |= (PR_BASIC | PR_EXTRA | PR_EQUIPPY | PR_MAP);
4960 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
4964 /* Array of places to find an inscription */
4965 static cptr find_quest[] =
4968 "¾²¤Ë¥á¥Ã¥»¡¼¥¸¤¬¹ï¤Þ¤ì¤Æ¤¤¤ë:",
4970 "You find the following inscription in the floor",
4974 "Êɤ˥á¥Ã¥»¡¼¥¸¤¬¹ï¤Þ¤ì¤Æ¤¤¤ë:",
4976 "You see a message inscribed in the wall",
4980 "¥á¥Ã¥»¡¼¥¸¤ò¸«¤Ä¤±¤¿:",
4982 "There is a sign saying",
4986 "²¿¤«¤¬³¬Ãʤξå¤Ë½ñ¤¤¤Æ¤¢¤ë:",
4988 "Something is written on the staircase",
4992 "´¬Êª¤ò¸«¤Ä¤±¤¿¡£¥á¥Ã¥»¡¼¥¸¤¬½ñ¤¤¤Æ¤¢¤ë:",
4994 "You find a scroll with the following message",
5003 void quest_discovery(int q_idx)
5005 quest_type *q_ptr = &quest[q_idx];
5006 monster_race *r_ptr = &r_info[q_ptr->r_idx];
5007 int q_num = q_ptr->max_num;
5010 /* No quest index */
5013 strcpy(name, (r_name + r_ptr->name));
5015 msg_print(find_quest[rand_range(0, 4)]);
5022 /* Hack -- "unique" monsters must be "unique" */
5023 if ((r_ptr->flags1 & RF1_UNIQUE) &&
5024 (0 == r_ptr->max_num))
5027 msg_print("¤³¤Î³¬¤Ï°ÊÁ°¤Ï狼¤Ë¤è¤Ã¤Æ¼é¤é¤ì¤Æ¤¤¤¿¤è¤¦¤À¡Ä¡£");
5029 msg_print("It seems that this level was protected by someone before...");
5031 /* The unique is already dead */
5032 quest[q_idx].status = QUEST_STATUS_FINISHED;
5037 msg_format("Ãí°Õ¤»¤è¡ª¤³¤Î³¬¤Ï%s¤Ë¤è¤Ã¤Æ¼é¤é¤ì¤Æ¤¤¤ë¡ª", name);
5039 msg_format("Beware, this level is protected by %s!", name);
5045 /* Normal monsters */
5047 msg_format("Ãí°Õ¤·¤í¡ª¤³¤Î³¬¤Ï%dÂΤÎ%s¤Ë¤è¤Ã¤Æ¼é¤é¤ì¤Æ¤¤¤ë¡ª", q_num, name);
5050 msg_format("Be warned, this level is guarded by %d %s!", q_num, name);
5058 * Hack -- Check if a level is a "quest" level
5060 int quest_number(int level)
5065 if (p_ptr->inside_quest)
5066 return (p_ptr->inside_quest);
5068 for (i = 0; i < max_quests; i++)
5070 if (quest[i].status != QUEST_STATUS_TAKEN) continue;
5072 if ((quest[i].type == QUEST_TYPE_KILL_LEVEL) &&
5073 !(quest[i].flags & QUEST_FLAG_PRESET) &&
5074 (quest[i].level == level) &&
5075 (quest[i].dungeon == dungeon_type))
5079 /* Check for random quest */
5080 return (random_quest_number(level));
5085 * Return the index of the random quest on this level
5088 int random_quest_number(int level)
5092 if (dungeon_type != DUNGEON_ANGBAND) return 0;
5094 for (i = MIN_RANDOM_QUEST; i < MAX_RANDOM_QUEST + 1; i++)
5096 if ((quest[i].type == QUEST_TYPE_RANDOM) &&
5097 (quest[i].status == QUEST_STATUS_TAKEN) &&
5098 (quest[i].level == level) &&
5099 (quest[i].dungeon == DUNGEON_ANGBAND))