3 @brief Ä®¤Î»ÜÀß½èÍý / Building commands
6 Created by Ken Wigle for Kangband - a variant of Angband 2.8.3\n
9 Rewritten for Kangband 2.8.3i using Kamband's version of\n
10 bldg.c as written by Ivan Tkatchev\n
12 Changed for ZAngband by Robert Ruehlmann\n
19 * ¥ë¡¼¥×Ãæ¤Ç / hack as in leave_store in store.c
21 static bool leave_bldg = FALSE;
24 * @brief »ÜÀßËè¤ËÀßÄꤵ¤ì¤¿¼ï²¡¢¿¦¶È¡¢ËâË¡Îΰè¥Õ¥é¥°¤¬¥×¥ì¥¤¥ä¡¼¤È°ìÃפ¹¤ë¤«¤òȽÄꤹ¤ë¡£
25 * @details ³Æ¼ï¥®¥ë¥É¤ä»û±¡¤Ê¤É¡¢ÆÃÄê¤Î¿¦¶È¤Ê¤é¤ÐÍ¥¶øÁ¼ÃÖ¤òÆÀ¤é¤ì¤ë»ÜÀß¡¢
26 * ¤¢¤ë¤¤¤Ï¿©Æ²¤Ê¤ÉÆÃÄê¤Î¼ï²¤Ç¤ÏÍøÍѤǤ¤Ê¤¤»ÜÀߤÎȽÄê½èÍý¤ò¹Ô¤¦¡£
27 * @param bldg »ÜÀß¹½Â¤ÂΤλ²¾È¥Ý¥¤¥ó¥¿
28 * @return ¼ï²¡¢¿¦¶È¡¢ËâË¡Îΰè¤Î¤¤¤º¤ì¤«¤¬°ìÃפ·¤Æ¤¤¤ë¤«¤ÎÀ§Èó¡£
30 static bool is_owner(building_type *bldg)
32 if (bldg->member_class[p_ptr->pclass] == BUILDING_OWNER)
37 if (bldg->member_race[p_ptr->prace] == BUILDING_OWNER)
42 if ((is_magic(p_ptr->realm1) && (bldg->member_realm[p_ptr->realm1] == BUILDING_OWNER)) ||
43 (is_magic(p_ptr->realm2) && (bldg->member_realm[p_ptr->realm2] == BUILDING_OWNER)))
52 * @brief »ÜÀßËè¤ËÀßÄꤵ¤ì¤¿¼ï²¡¢¿¦¶È¡¢ËâË¡Îΰè¥Õ¥é¥°¤¬¥×¥ì¥¤¥ä¡¼¤È°ìÃפ¹¤ë¤«¤òȽÄꤹ¤ë¡£
53 ¡Ê¥¹¥Ú¥ë¥Þ¥¹¥¿¡¼¤ÎÆÃÊÌȽÄê¤Ä¤¡Ë
54 * @details ³Æ¼ï¥®¥ë¥É¤ä»û±¡¤Ê¤É¡¢ÆÃÄê¤Î¿¦¶È¤Ê¤é¤ÐÍ¥¶øÁ¼ÃÖ¤òÆÀ¤é¤ì¤ë»ÜÀß¡¢
55 * ¤¢¤ë¤¤¤Ï¿©Æ²¤Ê¤ÉÆÃÄê¤Î¼ï²¤Ç¤ÏÍøÍѤǤ¤Ê¤¤»ÜÀߤÎȽÄê½èÍý¤ò¹Ô¤¦¡£
56 * @param bldg »ÜÀß¹½Â¤ÂΤλ²¾È¥Ý¥¤¥ó¥¿
57 * @return ¼ï²¡¢¿¦¶È¡¢ËâË¡Îΰè¤Î¤¤¤º¤ì¤«¤¬°ìÃפ·¤Æ¤¤¤ë¤«¤ÎÀ§Èó¡£
58 * @todo is_owner()¤È¤Î¼Â¼ÁŪ¤Ê¿½Å¼ÂÁõ¤Ê¤Î¤Ç¡¢¥ê¥Õ¥¡¥¯¥¿¥ê¥ó¥°¤ò¹Ô¤¦¤Ù¤¤Ç¤¢¤ë¡£
60 static bool is_member(building_type *bldg)
62 if (bldg->member_class[p_ptr->pclass])
67 if (bldg->member_race[p_ptr->prace])
72 if ((is_magic(p_ptr->realm1) && bldg->member_realm[p_ptr->realm1]) ||
73 (is_magic(p_ptr->realm2) && bldg->member_realm[p_ptr->realm2]))
79 if (p_ptr->pclass == CLASS_SORCERER)
83 for (i = 0; i < MAX_MAGIC; i++)
85 if (bldg->member_realm[i+1]) OK = TRUE;
93 * @brief ¥³¥ó¥½¡¼¥ë¤Ëɽ¼¨¤µ¤ì¤¿»ÜÀߤ˴ؤ¹¤ë¾ðÊó¤ò¾Ãµî¤¹¤ë / Clear the building information
94 * @details ¾Ãµî¤Ï¹ÔËè¤Ë¥Ì¥ëʸ»úÎó¤Ç¹Ô¤ï¤ì¤ë¡£
95 * @param min_row ³«»Ï¹ÔÈÖ¹æ
96 * @param max_row ËöÈø¹ÔÈÖ¹æ
99 static void clear_bldg(int min_row, int max_row)
103 for (i = min_row; i <= max_row; i++)
108 * @brief ½ê»ý¶â¤òɽ¼¨¤¹¤ë¡£
112 static void building_prt_gold(void)
117 prt("¼ê»ý¤Á¤Î¤ª¶â: ", 23,53);
119 prt("Gold Remaining: ", 23, 53);
123 sprintf(tmp_str, "%9ld", (long)p_ptr->au);
124 prt(tmp_str, 23, 68);
128 * @brief »ÜÀߤΥµ¡¼¥Ó¥¹°ìÍ÷¤òɽ¼¨¤¹¤ë / Display a building.
129 * @param bldg »ÜÀß¹½Â¤ÂΤλ²¾È¥Ý¥¤¥ó¥¿
132 static void show_building(building_type* bldg)
140 sprintf(tmp_str, "%s (%s) %35s", bldg->owner_name, bldg->owner_race, bldg->name);
144 for (i = 0; i < 8; i++)
146 if (bldg->letters[i])
148 if (bldg->action_restr[i] == 0)
150 if ((is_owner(bldg) && (bldg->member_costs[i] == 0)) ||
151 (!is_owner(bldg) && (bldg->other_costs[i] == 0)))
153 action_color = TERM_WHITE;
156 else if (is_owner(bldg))
158 action_color = TERM_YELLOW;
160 sprintf(buff, "($%ld)", (long int)bldg->member_costs[i]);
162 sprintf(buff, "(%ldgp)", (long int)bldg->member_costs[i]);
168 action_color = TERM_YELLOW;
170 sprintf(buff, "($%ld)", (long int)bldg->other_costs[i]);
172 sprintf(buff, "(%ldgp)", (long int)bldg->other_costs[i]);
177 else if (bldg->action_restr[i] == 1)
179 if (!is_member(bldg))
181 action_color = TERM_L_DARK;
183 strcpy(buff, "(ÊÄŹ)");
185 strcpy(buff, "(closed)");
189 else if ((is_owner(bldg) && (bldg->member_costs[i] == 0)) ||
190 (is_member(bldg) && (bldg->other_costs[i] == 0)))
192 action_color = TERM_WHITE;
195 else if (is_owner(bldg))
197 action_color = TERM_YELLOW;
199 sprintf(buff, "($%ld)", (long int)bldg->member_costs[i]);
201 sprintf(buff, "(%ldgp)", (long int)bldg->member_costs[i]);
207 action_color = TERM_YELLOW;
209 sprintf(buff, "($%ld)", (long int)bldg->other_costs[i]);
211 sprintf(buff, "(%ldgp)", (long int)bldg->other_costs[i]);
220 action_color = TERM_L_DARK;
222 strcpy(buff, "(ÊÄŹ)");
224 strcpy(buff, "(closed)");
228 else if (bldg->member_costs[i] != 0)
230 action_color = TERM_YELLOW;
232 sprintf(buff, "($%ld)", (long int)bldg->member_costs[i]);
234 sprintf(buff, "(%ldgp)", (long int)bldg->member_costs[i]);
240 action_color = TERM_WHITE;
245 sprintf(tmp_str," %c) %s %s", bldg->letters[i], bldg->act_names[i], buff);
246 c_put_str(action_color, tmp_str, 19+(i/2), 35*(i%2));
251 prt(" ESC) ·úʪ¤ò½Ð¤ë", 23, 0);
253 prt(" ESC) Exit building", 23, 0);
259 * @brief Æ®µ»¾ì¤ËÆþ¤ë¥³¥Þ¥ó¥É¤Î½èÍý / arena commands
260 * @param cmd Æ®µ»¾ì½èÍý¤ÎID
263 static void arena_comm(int cmd)
272 if (p_ptr->arena_number == MAX_ARENA_MONS)
276 prt("¥¢¥ê¡¼¥Ê¤ÎÍ¥¾¡¼Ô¡ª", 5, 0);
277 prt("¤ª¤á¤Ç¤È¤¦¡ª¤¢¤Ê¤¿¤ÏÁ´¤Æ¤ÎŨ¤òÅݤ·¤Þ¤·¤¿¡£", 7, 0);
278 prt("¾Þ¶â¤È¤·¤Æ $1,000,000 ¤¬Í¿¤¨¤é¤ì¤Þ¤¹¡£", 8, 0);
280 prt(" Arena Victor!", 5, 0);
281 prt("Congratulations! You have defeated all before you.", 7, 0);
282 prt("For that, receive the prize: 1,000,000 gold pieces", 8, 0);
287 p_ptr->au += 1000000L;
289 msg_print("¥¹¥Ú¡¼¥¹¥¡¼¤Ç³¹Ô");
291 msg_print("Press the space bar to continue");
295 p_ptr->arena_number++;
297 else if (p_ptr->arena_number > MAX_ARENA_MONS)
299 if (p_ptr->arena_number < MAX_ARENA_MONS+2)
302 msg_print("·¯¤Î¤¿¤á¤ËºÇ¶¯¤ÎÄ©Àï¼Ô¤òÍÑ°Õ¤·¤Æ¤ª¤¤¤¿¡£");
304 msg_print("The strongest challenger is waiting for you.");
309 if (get_check("Ä©À魯¤ë¤«¤Í¡©"))
311 if (get_check("Do you fight? "))
315 msg_print("»à¤Ì¤¬¤è¤¤¡£");
317 msg_print("Die, maggots.");
321 p_ptr->exit_bldg = FALSE;
324 /* Save the surface floor as saved floor */
325 prepare_change_floor_mode(CFM_SAVE_FLOORS);
327 p_ptr->inside_arena = TRUE;
328 p_ptr->leaving = TRUE;
334 msg_print("»ÄÇ°¤À¡£");
336 msg_print("We are disappointed.");
343 msg_print("¤¢¤Ê¤¿¤Ï¥¢¥ê¡¼¥Ê¤ËÆþ¤ê¡¢¤·¤Ð¤é¤¯¤Î´Ö±É¸÷¤Ë¤Ò¤¿¤Ã¤¿¡£");
345 msg_print("You enter the arena briefly and bask in your glory.");
351 else if (p_ptr->riding && (p_ptr->pclass != CLASS_BEASTMASTER) && (p_ptr->pclass != CLASS_CAVALRY))
354 msg_print("¥Ú¥Ã¥È¤Ë¾è¤Ã¤¿¤Þ¤Þ¤Ç¤Ï¥¢¥ê¡¼¥Ê¤ØÆþ¤ì¤µ¤»¤Æ¤â¤é¤¨¤Ê¤«¤Ã¤¿¡£");
356 msg_print("You don't have permission to enter with pet.");
363 p_ptr->exit_bldg = FALSE;
366 /* Save the surface floor as saved floor */
367 prepare_change_floor_mode(CFM_SAVE_FLOORS);
369 p_ptr->inside_arena = TRUE;
370 p_ptr->leaving = TRUE;
375 if (p_ptr->arena_number == MAX_ARENA_MONS)
377 msg_print("¤¢¤Ê¤¿¤Ï¾¡Íø¼Ô¤À¡£ ¥¢¥ê¡¼¥Ê¤Ç¤Î¥»¥ì¥â¥Ë¡¼¤Ë»²²Ã¤·¤Ê¤µ¤¤¡£");
379 msg_print("You are victorious. Enter the arena for the ceremony.");
382 else if (p_ptr->arena_number > MAX_ARENA_MONS)
385 msg_print("¤¢¤Ê¤¿¤Ï¤¹¤Ù¤Æ¤ÎŨ¤Ë¾¡Íø¤·¤¿¡£");
387 msg_print("You have won against all foes.");
392 r_ptr = &r_info[arena_info[p_ptr->arena_number].r_idx];
393 name = (r_name + r_ptr->name);
395 msg_format("%s ¤ËÄ©À魯¤ë¤â¤Î¤Ï¤¤¤Ê¤¤¤«¡©", name);
397 msg_format("Do I hear any challenges against: %s", name);
401 case BACT_ARENA_RULES:
406 /* Peruse the arena help file */
408 (void)show_file(TRUE, "arena_j.txt", NULL, 0, 0);
410 (void)show_file(TRUE, "arena.txt", NULL, 0, 0);
422 * @brief ¥«¥¸¥Î¤Î¥¹¥í¥Ã¥È¥·¥ó¥Ü¥ë¤òɽ¼¨¤¹¤ë / display fruit for dice slots
423 * @param row ¥·¥ó¥Ü¥ë¤òɽ¼¨¤¹¤ë¹Ô¤Î¾åü
424 * @param col ¥·¥ó¥Ü¥ë¤òɽ¼¨¤¹¤ë¹Ô¤Îº¸Ã¼
425 * @param fruit ɽ¼¨¤¹¤ë¥·¥ó¥Ü¥ëID
428 static void display_fruit(int row, int col, int fruit)
434 c_put_str(TERM_YELLOW, " ####.", row, col);
435 c_put_str(TERM_YELLOW, " # #", row + 1, col);
436 c_put_str(TERM_YELLOW, " # #", row + 2, col);
437 c_put_str(TERM_YELLOW, "# #", row + 3, col);
438 c_put_str(TERM_YELLOW, "# #", row + 4, col);
439 c_put_str(TERM_YELLOW, "# # ", row + 5, col);
440 c_put_str(TERM_YELLOW, "# # ", row + 6, col);
441 c_put_str(TERM_YELLOW, ".#### ", row + 7, col);
442 prt( " ¥ì¥â¥ó ", row + 8, col);
444 c_put_str(TERM_YELLOW, " ####.", row, col);
445 c_put_str(TERM_YELLOW, " # #", row + 1, col);
446 c_put_str(TERM_YELLOW, " # #", row + 2, col);
447 c_put_str(TERM_YELLOW, "# #", row + 3, col);
448 c_put_str(TERM_YELLOW, "# #", row + 4, col);
449 c_put_str(TERM_YELLOW, "# # ", row + 5, col);
450 c_put_str(TERM_YELLOW, "# # ", row + 6, col);
451 c_put_str(TERM_YELLOW, ".#### ", row + 7, col);
452 prt( " Lemon ", row + 8, col);
458 c_put_str(TERM_ORANGE, " ## ", row, col);
459 c_put_str(TERM_ORANGE, " #..# ", row + 1, col);
460 c_put_str(TERM_ORANGE, " #....# ", row + 2, col);
461 c_put_str(TERM_ORANGE, "#......#", row + 3, col);
462 c_put_str(TERM_ORANGE, "#......#", row + 4, col);
463 c_put_str(TERM_ORANGE, " #....# ", row + 5, col);
464 c_put_str(TERM_ORANGE, " #..# ", row + 6, col);
465 c_put_str(TERM_ORANGE, " ## ", row + 7, col);
466 prt( "¥ª¥ì¥ó¥¸", row + 8, col);
468 c_put_str(TERM_ORANGE, " ## ", row, col);
469 c_put_str(TERM_ORANGE, " #..# ", row + 1, col);
470 c_put_str(TERM_ORANGE, " #....# ", row + 2, col);
471 c_put_str(TERM_ORANGE, "#......#", row + 3, col);
472 c_put_str(TERM_ORANGE, "#......#", row + 4, col);
473 c_put_str(TERM_ORANGE, " #....# ", row + 5, col);
474 c_put_str(TERM_ORANGE, " #..# ", row + 6, col);
475 c_put_str(TERM_ORANGE, " ## ", row + 7, col);
476 prt( " Orange ", row + 8, col);
482 c_put_str(TERM_SLATE, " ¦« " , row, col);
483 c_put_str(TERM_SLATE, " || " , row + 1, col);
484 c_put_str(TERM_SLATE, " || " , row + 2, col);
485 c_put_str(TERM_SLATE, " || " , row + 3, col);
486 c_put_str(TERM_SLATE, " || " , row + 4, col);
487 c_put_str(TERM_SLATE, " || " , row + 5, col);
488 c_put_str(TERM_UMBER, " |=°¡=| " , row + 6, col);
489 c_put_str(TERM_UMBER, " ÌÜ " , row + 7, col);
490 prt( " ·õ " , row + 8, col);
492 c_put_str(TERM_SLATE, " /\\ " , row, col);
493 c_put_str(TERM_SLATE, " ## " , row + 1, col);
494 c_put_str(TERM_SLATE, " ## " , row + 2, col);
495 c_put_str(TERM_SLATE, " ## " , row + 3, col);
496 c_put_str(TERM_SLATE, " ## " , row + 4, col);
497 c_put_str(TERM_SLATE, " ## " , row + 5, col);
498 c_put_str(TERM_UMBER, " ###### " , row + 6, col);
499 c_put_str(TERM_UMBER, " ## " , row + 7, col);
500 prt( " Sword " , row + 8, col);
506 c_put_str(TERM_SLATE, " ###### ", row, col);
507 c_put_str(TERM_SLATE, "# #", row + 1, col);
508 c_put_str(TERM_SLATE, "# ++++ #", row + 2, col);
509 c_put_str(TERM_SLATE, "# +==+ #", row + 3, col);
510 c_put_str(TERM_SLATE, "# ++ #", row + 4, col);
511 c_put_str(TERM_SLATE, " # # ", row + 5, col);
512 c_put_str(TERM_SLATE, " # # ", row + 6, col);
513 c_put_str(TERM_SLATE, " ## ", row + 7, col);
514 prt( " ½â ", row + 8, col);
516 c_put_str(TERM_SLATE, " ###### ", row, col);
517 c_put_str(TERM_SLATE, "# #", row + 1, col);
518 c_put_str(TERM_SLATE, "# ++++ #", row + 2, col);
519 c_put_str(TERM_SLATE, "# +==+ #", row + 3, col);
520 c_put_str(TERM_SLATE, "# ++ #", row + 4, col);
521 c_put_str(TERM_SLATE, " # # ", row + 5, col);
522 c_put_str(TERM_SLATE, " # # ", row + 6, col);
523 c_put_str(TERM_SLATE, " ## ", row + 7, col);
524 prt( " Shield ", row + 8, col);
530 c_put_str(TERM_VIOLET, " ## ", row, col);
531 c_put_str(TERM_VIOLET, " ###### ", row + 1, col);
532 c_put_str(TERM_VIOLET, "########", row + 2, col);
533 c_put_str(TERM_VIOLET, "########", row + 3, col);
534 c_put_str(TERM_VIOLET, "########", row + 4, col);
535 c_put_str(TERM_VIOLET, " ###### ", row + 5, col);
536 c_put_str(TERM_VIOLET, " #### ", row + 6, col);
537 c_put_str(TERM_VIOLET, " ## ", row + 7, col);
538 prt( " ¥×¥é¥à ", row + 8, col);
540 c_put_str(TERM_VIOLET, " ## ", row, col);
541 c_put_str(TERM_VIOLET, " ###### ", row + 1, col);
542 c_put_str(TERM_VIOLET, "########", row + 2, col);
543 c_put_str(TERM_VIOLET, "########", row + 3, col);
544 c_put_str(TERM_VIOLET, "########", row + 4, col);
545 c_put_str(TERM_VIOLET, " ###### ", row + 5, col);
546 c_put_str(TERM_VIOLET, " #### ", row + 6, col);
547 c_put_str(TERM_VIOLET, " ## ", row + 7, col);
548 prt( " Plum ", row + 8, col);
554 c_put_str(TERM_RED, " ##", row, col);
555 c_put_str(TERM_RED, " ### ", row + 1, col);
556 c_put_str(TERM_RED, " #..# ", row + 2, col);
557 c_put_str(TERM_RED, " #..# ", row + 3, col);
558 c_put_str(TERM_RED, " ###### ", row + 4, col);
559 c_put_str(TERM_RED, "#..##..#", row + 5, col);
560 c_put_str(TERM_RED, "#..##..#", row + 6, col);
561 c_put_str(TERM_RED, " ## ## ", row + 7, col);
562 prt( "¥Á¥§¥ê¡¼", row + 8, col);
564 c_put_str(TERM_RED, " ##", row, col);
565 c_put_str(TERM_RED, " ### ", row + 1, col);
566 c_put_str(TERM_RED, " #..# ", row + 2, col);
567 c_put_str(TERM_RED, " #..# ", row + 3, col);
568 c_put_str(TERM_RED, " ###### ", row + 4, col);
569 c_put_str(TERM_RED, "#..##..#", row + 5, col);
570 c_put_str(TERM_RED, "#..##..#", row + 6, col);
571 c_put_str(TERM_RED, " ## ## ", row + 7, col);
572 prt( " Cherry ", row + 8, col);
580 * kpoker no (tyuto-hannpa na)pakuri desu...
581 * joker ha shineru node haitte masen.
583 * TODO: donataka! tsukutte!
584 * - agatta yaku no kiroku (like DQ).
585 * - kakkoii card no e.
586 * - sousa-sei no koujyo.
587 * - code wo wakariyasuku.
589 * - Joker... -- done.
592 * 9/15/2000 joker wo jissou. soreto, code wo sukosi kakikae. --Habu
594 #define SUIT_OF(card) ((card) / 13)
595 #define NUM_OF(card) ((card) % 13)
596 #define IS_JOKER(card) ((card) == 52)
598 static int cards[5]; /* tefuda no card */
600 static void reset_deck(int deck[])
603 for (i = 0; i < 53; i++) deck[i] = i;
606 for (i = 0; i < 53; i++){
607 int tmp1 = randint0(53 - i) + i;
609 deck[i] = deck[tmp1];
614 static bool have_joker(void)
618 for (i = 0; i < 5; i++){
619 if(IS_JOKER(cards[i])) return TRUE;
624 static bool find_card_num(int num)
627 for (i = 0; i < 5; i++)
628 if (NUM_OF(cards[i]) == num && !IS_JOKER(cards[i])) return TRUE;
632 static bool yaku_check_flush(void)
635 bool joker_is_used = FALSE;
637 suit = IS_JOKER(cards[0]) ? SUIT_OF(cards[1]) : SUIT_OF(cards[0]);
638 for (i = 0; i < 5; i++){
639 if (SUIT_OF(cards[i]) != suit){
640 if(have_joker() && !joker_is_used)
641 joker_is_used = TRUE;
650 static int yaku_check_straight(void)
653 bool joker_is_used = FALSE;
656 for (i = 0; i < 5; i++)
658 if (NUM_OF(cards[i]) < lowest && !IS_JOKER(cards[i]))
659 lowest = NUM_OF(cards[i]);
662 if (yaku_check_flush())
665 for (i = 0; i < 4; i++)
667 if (!find_card_num(9 + i)){
668 if( have_joker() && !joker_is_used )
669 joker_is_used = TRUE;
674 if (i == 4) return 3; /* Wow! Royal Flush!!! */
677 for (i = 0; i < 3; i++)
679 if (!find_card_num(10 + i))
682 if (i == 3 && have_joker()) return 3; /* Wow! Royal Flush!!! */
686 joker_is_used = FALSE;
687 for (i = 0; i < 5; i++)
689 if (!find_card_num(lowest + i)){
690 if( have_joker() && !joker_is_used )
691 joker_is_used = TRUE;
697 if (yaku_check_flush())
698 return 2; /* Straight Flush */
704 * 0:nopair 1:1 pair 2:2 pair 3:3 cards 4:full house 6:4cards
706 static int yaku_check_pair(void)
708 int i, i2, matching = 0;
710 for (i = 0; i < 5; i++)
712 for (i2 = i+1; i2 < 5; i2++)
714 if (IS_JOKER(cards[i]) || IS_JOKER(cards[i2])) continue;
715 if (NUM_OF(cards[i]) == NUM_OF(cards[i2]))
757 static int yaku_check(void)
761 switch(yaku_check_straight()){
764 c_put_str(TERM_YELLOW, "¥í¥¤¥ä¥ë¥¹¥È¥ì¡¼¥È¥Õ¥é¥Ã¥·¥å", 4, 3);
766 c_put_str(TERM_YELLOW, "Royal Flush", 4, 3);
771 c_put_str(TERM_YELLOW, "¥¹¥È¥ì¡¼¥È¥Õ¥é¥Ã¥·¥å", 4, 3);
773 c_put_str(TERM_YELLOW, "Straight Flush", 4, 3);
778 c_put_str(TERM_YELLOW, "¥¹¥È¥ì¡¼¥È", 4, 3);
780 c_put_str(TERM_YELLOW, "Straight", 4, 3);
784 /* Not straight -- fall through */
788 if (yaku_check_flush())
792 c_put_str(TERM_YELLOW, "¥Õ¥é¥Ã¥·¥å", 4, 3);
794 c_put_str(TERM_YELLOW, "Flush", 4, 3);
799 switch (yaku_check_pair())
803 c_put_str(TERM_YELLOW, "¥ï¥ó¥Ú¥¢", 4, 3);
805 c_put_str(TERM_YELLOW, "One pair", 4, 3);
810 c_put_str(TERM_YELLOW, "¥Ä¡¼¥Ú¥¢", 4, 3);
812 c_put_str(TERM_YELLOW, "Two pair", 4, 3);
817 c_put_str(TERM_YELLOW, "¥¹¥ê¡¼¥«¡¼¥É", 4, 3);
819 c_put_str(TERM_YELLOW, "Three of a kind", 4, 3);
824 c_put_str(TERM_YELLOW, "¥Õ¥ë¥Ï¥¦¥¹", 4, 3);
826 c_put_str(TERM_YELLOW, "Full house", 4, 3);
831 c_put_str(TERM_YELLOW, "¥Õ¥©¡¼¥«¡¼¥É", 4, 3);
833 c_put_str(TERM_YELLOW, "Four of a kind", 4, 3);
837 if (!NUM_OF(cards[0]) || !NUM_OF(cards[1]))
840 c_put_str(TERM_YELLOW, "¥Õ¥¡¥¤¥Ö¥¨¡¼¥¹", 4, 3);
842 c_put_str(TERM_YELLOW, "Five ace", 4, 3);
849 c_put_str(TERM_YELLOW, "¥Õ¥¡¥¤¥Ö¥«¡¼¥É", 4, 3);
851 c_put_str(TERM_YELLOW, "Five of a kind", 4, 3);
861 static void display_kaeruka(int hoge, int kaeruka[])
864 char col = TERM_WHITE;
865 for (i = 0; i < 5; i++)
867 if (i == hoge) col = TERM_YELLOW;
868 else if(kaeruka[i]) col = TERM_WHITE;
869 else col = TERM_L_BLUE;
872 c_put_str(col, "¤«¤¨¤ë", 14, 5+i*16);
874 c_put_str(col, "¤Î¤³¤¹", 14, 5+i*16);
877 c_put_str(col, "Change", 14, 5+i*16);
879 c_put_str(col, " Stay ", 14, 5+i*16);
882 if (hoge > 4) col = TERM_YELLOW;
883 else col = TERM_WHITE;
885 c_put_str(col, "·èÄê", 16, 38);
887 c_put_str(col, "Sure", 16, 38);
890 /* Hilite current option */
891 if (hoge < 5) move_cursor(14, 5+hoge*16);
892 else move_cursor(16, 38);
896 static void display_cards(void)
899 char suitcolor[4] = {TERM_YELLOW, TERM_L_RED, TERM_L_BLUE, TERM_L_GREEN};
901 cptr suit[4] = {"¡ú", "¡ü", "¢ù", "¢÷"};
902 cptr card_grph[13][7] = {{"£Á %s ",
993 cptr joker_grph[7] = { " ",
1003 cptr suit[4] = {"[]", "qp", "<>", "db"};
1004 cptr card_grph[13][7] = {{"A %s ",
1095 cptr joker_grph[7] = { " ",
1104 for (i = 0; i < 5; i++)
1107 prt("¨®¨¬¨¬¨¬¨¬¨¬¨¬¨¯", 5, i*16);
1109 prt(" +------------+ ", 5, i*16);
1113 for (i = 0; i < 5; i++)
1115 for (j = 0; j < 7; j++)
1118 prt("¨", j+6, i*16);
1120 prt(" |", j+6, i*16);
1122 if(IS_JOKER(cards[i]))
1123 c_put_str(TERM_VIOLET, joker_grph[j], j+6, 2+i*16);
1125 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);
1127 prt("¨", j+6, i*16+14);
1129 prt("| ", j+6, i*16+14);
1133 for (i = 0; i < 5; i++)
1136 prt("¨±¨¬¨¬¨¬¨¬¨¬¨¬¨°", 13, i*16);
1138 prt(" +------------+ ", 13, i*16);
1143 static int do_poker(void)
1147 int deck[53]; /* yamafuda : 0...52 */
1149 int kaeruka[5]; /* 0:kaenai 1:kaeru */
1153 bool kakikae = TRUE;
1157 for (i = 0; i < 5; i++)
1159 cards[i] = deck[deck_ptr++];
1160 kaeruka[i] = 0; /* default:nokosu */
1180 /* debug:Four Cards */
1182 cards[1] = 0 + 13 * 1;
1183 cards[2] = 0 + 13 * 2;
1184 cards[3] = 0 + 13 * 3;
1188 /* debug:Straight */
1204 /* suteruno wo kimeru */
1206 prt("»Ä¤¹¥«¡¼¥É¤ò·è¤á¤Æ²¼¤µ¤¤(Êý¸þ¤Ç°ÜÆ°, ¥¹¥Ú¡¼¥¹¤ÇÁªÂò)¡£", 0, 0);
1208 prt("Stay witch? ", 0, 0);
1216 if (kakikae) display_kaeruka(k+kettei*5, kaeruka);
1221 case '6': case 'l': case 'L': case KTRL('F'):
1222 if (!kettei) k = (k+1)%5;
1223 else {k = 0;kettei = FALSE;}
1226 case '4': case 'h': case 'H': case KTRL('B'):
1227 if (!kettei) k = (k+4)%5;
1228 else {k = 4;kettei = FALSE;}
1231 case '2': case 'j': case 'J': case KTRL('N'):
1232 if (!kettei) {kettei = TRUE;kakikae = TRUE;}
1234 case '8': case 'k': case 'K': case KTRL('P'):
1235 if (kettei) {kettei = FALSE;kakikae = TRUE;}
1237 case ' ': case '\r':
1238 if (kettei) done = TRUE;
1239 else {kaeruka[k] = !kaeruka[k];kakikae = TRUE;}
1248 for (i = 0; i < 5; i++)
1249 if (kaeruka[i] == 1) cards[i] = deck[deck_ptr++]; /* soshite toru */
1253 return yaku_check();
1258 /* end of poker codes --Koka */
1263 static bool gamble_comm(int cmd)
1266 int roll1, roll2, roll3, choice, odds, win;
1271 char out_val[160], tmp_str[80], again;
1276 if (cmd == BACT_GAMBLE_RULES)
1278 /* Peruse the gambling help file */
1280 (void)show_file(TRUE, "jgambling.txt", NULL, 0, 0);
1282 (void)show_file(TRUE, "gambling.txt", NULL, 0, 0);
1292 msg_print("¤ª¤¤¡ª¤ª¤Þ¤¨°ìʸ¤Ê¤·¤¸¤ã¤Ê¤¤¤«¡ª¤³¤Ã¤«¤é½Ð¤Æ¤¤¤±¡ª");
1294 msg_print("Hey! You don't have gold - get out of here!");
1304 maxbet = p_ptr->lev * 200;
1306 /* We can't bet more than we have */
1307 maxbet = MIN(maxbet, p_ptr->au);
1310 strcpy(out_val, "");
1312 sprintf(tmp_str,"ÅÒ¤±¶â (1-%ld)¡©", (long int)maxbet);
1314 sprintf(tmp_str,"Your wager (1-%ld) ? ", (long int)maxbet);
1319 * Use get_string() because we may need more than
1320 * the s16b value returned by get_quantity().
1322 if (get_string(tmp_str, out_val, 32))
1325 for (p = out_val; *p == ' '; p++);
1330 if (wager > p_ptr->au)
1333 msg_print("¤ª¤¤¡ª¶â¤¬Â¤ê¤Ê¤¤¤¸¤ã¤Ê¤¤¤«¡ª½Ð¤Æ¤¤¤±¡ª");
1335 msg_print("Hey! You don't have the gold - get out of here!");
1342 else if (wager > maxbet)
1345 msg_format("%ld¥´¡¼¥ë¥É¤À¤±¼õ¤±¤è¤¦¡£»Ä¤ê¤Ï¼è¤Ã¤È¤¤Ê¡£", (long int)maxbet);
1347 msg_format("I'll take %ld gold of that. Keep the rest.", (long int)maxbet);
1355 msg_print("£Ï£Ë¡¢£±¥´¡¼¥ë¥É¤«¤é¤Ï¤¸¤á¤è¤¦¡£");
1357 msg_print("Ok, we'll start with 1 gold.");
1366 oldgold = p_ptr->au;
1369 sprintf(tmp_str, "¥²¡¼¥àÁ°¤Î½ê»ý¶â: %9ld", (long int)oldgold);
1371 sprintf(tmp_str, "Gold before game: %9ld", (long int)oldgold);
1374 prt(tmp_str, 20, 2);
1377 sprintf(tmp_str, "¸½ºß¤Î³Ý¤±¶â: %9ld", (long int)wager);
1379 sprintf(tmp_str, "Current Wager: %9ld", (long int)wager);
1382 prt(tmp_str, 21, 2);
1389 case BACT_IN_BETWEEN: /* Game of In-Between */
1391 c_put_str(TERM_GREEN, "¥¤¥ó¡¦¥Ó¥È¥¤¡¼¥ó",5,2);
1393 c_put_str(TERM_GREEN, "In Between", 5, 2);
1398 roll1 = randint1(10);
1399 roll2 = randint1(10);
1400 choice = randint1(10);
1402 sprintf(tmp_str, "¹õ¥À¥¤¥¹: %d ¹õ¥À¥¤¥¹: %d", roll1, roll2);
1404 sprintf(tmp_str, "Black die: %d Black Die: %d", roll1, roll2);
1409 sprintf(tmp_str, "ÀÖ¥À¥¤¥¹: %d", choice);
1411 sprintf(tmp_str, "Red die: %d", choice);
1414 prt(tmp_str, 11, 14);
1415 if (((choice > roll1) && (choice < roll2)) ||
1416 ((choice < roll1) && (choice > roll2)))
1419 case BACT_CRAPS: /* Game of Craps */
1421 c_put_str(TERM_GREEN, "¥¯¥é¥Ã¥×¥¹", 5, 2);
1423 c_put_str(TERM_GREEN, "Craps", 5, 2);
1428 roll1 = randint1(6);
1429 roll2 = randint1(6);
1430 roll3 = roll1 + roll2;
1433 sprintf(tmp_str, "£±¿¶¤ê¤á: %d %d Total: %d", roll1,
1435 sprintf(tmp_str, "First roll: %d %d Total: %d", roll1,
1440 if ((roll3 == 7) || (roll3 == 11))
1442 else if ((roll3 == 2) || (roll3 == 3) || (roll3 == 12))
1448 msg_print("¤Ê¤Ë¤«¥¡¼¤ò²¡¤¹¤È¤â¤¦°ì²ó¿¶¤ê¤Þ¤¹¡£");
1450 msg_print("Hit any key to roll again");
1454 roll1 = randint1(6);
1455 roll2 = randint1(6);
1456 roll3 = roll1 + roll2;
1459 sprintf(tmp_str, "½ÐÌÜ: %d %d ¹ç·×: %d",
1461 sprintf(tmp_str, "Roll result: %d %d Total: %d",
1464 roll1, roll2, roll3);
1466 if (roll3 == choice)
1468 else if (roll3 == 7)
1470 } while ((win != TRUE) && (win != FALSE));
1473 case BACT_SPIN_WHEEL: /* Spin the Wheel Game */
1477 c_put_str(TERM_GREEN, "¥ë¡¼¥ì¥Ã¥È", 5, 2);
1479 c_put_str(TERM_GREEN, "Wheel", 5, 2);
1482 prt("0 1 2 3 4 5 6 7 8 9", 7, 5);
1483 prt("--------------------------------", 8, 3);
1484 strcpy(out_val, "");
1486 get_string("²¿ÈÖ¡© (0-9): ", out_val, 32);
1488 get_string("Pick a number (0-9): ", out_val, 32);
1491 for (p = out_val; iswspace(*p); p++);
1496 msg_print("0È֤ˤ·¤È¤¯¤¼¡£");
1498 msg_print("I'll put you down for 0.");
1503 else if (choice > 9)
1506 msg_print("£Ï£Ë¡¢9È֤ˤ·¤È¤¯¤¼¡£");
1508 msg_print("Ok, I'll put you down for 9.");
1514 roll1 = randint0(10);
1516 sprintf(tmp_str, "¥ë¡¼¥ì¥Ã¥È¤Ï²ó¤ê¡¢»ß¤Þ¤Ã¤¿¡£¾¡¼Ô¤Ï %dÈÖ¤À¡£",
1518 sprintf(tmp_str, "The wheel spins to a stop and the winner is %d",
1522 prt(tmp_str, 13, 3);
1524 prt("*", 9, (3 * roll1 + 5));
1525 if (roll1 == choice)
1529 case BACT_DICE_SLOTS: /* The Dice Slots */
1531 c_put_str(TERM_GREEN, "¥À¥¤¥¹¡¦¥¹¥í¥Ã¥È", 5, 2);
1532 c_put_str(TERM_YELLOW, "¥ì¥â¥ó ¥ì¥â¥ó 2", 6, 37);
1533 c_put_str(TERM_YELLOW, "¥ì¥â¥ó ¥ì¥â¥ó ¥ì¥â¥ó 5", 7, 37);
1534 c_put_str(TERM_ORANGE, "¥ª¥ì¥ó¥¸ ¥ª¥ì¥ó¥¸ ¥ª¥ì¥ó¥¸ 10", 8, 37);
1535 c_put_str(TERM_UMBER, "·õ ·õ ·õ 20", 9, 37);
1536 c_put_str(TERM_SLATE, "½â ½â ½â 50", 10, 37);
1537 c_put_str(TERM_VIOLET, "¥×¥é¥à ¥×¥é¥à ¥×¥é¥à 200", 11, 37);
1538 c_put_str(TERM_RED, "¥Á¥§¥ê¡¼ ¥Á¥§¥ê¡¼ ¥Á¥§¥ê¡¼ 1000", 12, 37);
1540 c_put_str(TERM_GREEN, "Dice Slots", 5, 2);
1544 roll1 = randint1(21);
1554 roll2 = randint1(21);
1564 choice = randint1(21);
1574 put_str("/--------------------------\\", 7, 2);
1575 prt("\\--------------------------/", 17, 2);
1576 display_fruit(8, 3, roll1 - 1);
1577 display_fruit(8, 12, roll2 - 1);
1578 display_fruit(8, 21, choice - 1);
1579 if ((roll1 == roll2) && (roll2 == choice))
1598 else if ((roll1 == 1) && (roll2 == 1))
1607 if (odds) win = TRUE;
1614 prt("¤¢¤Ê¤¿¤Î¾¡¤Á", 16, 37);
1616 prt("YOU WON", 16, 37);
1619 p_ptr->au += odds * wager;
1621 sprintf(tmp_str, "ÇÜΨ: %d", odds);
1623 sprintf(tmp_str, "Payoff: %d", odds);
1626 prt(tmp_str, 17, 37);
1631 prt("¤¢¤Ê¤¿¤ÎÉ餱", 16, 37);
1633 prt("You Lost", 16, 37);
1639 sprintf(tmp_str, "¸½ºß¤Î½ê»ý¶â: %9ld", (long int)p_ptr->au);
1641 sprintf(tmp_str, "Current Gold: %9ld", (long int)p_ptr->au);
1644 prt(tmp_str, 22, 2);
1646 prt("¤â¤¦°ìÅÙ(Y/N)¡©", 18, 37);
1648 prt("Again(Y/N)?", 18, 37);
1651 move_cursor(18, 52);
1656 if (wager > p_ptr->au)
1659 msg_print("¤ª¤¤¡ª¶â¤¬Â¤ê¤Ê¤¤¤¸¤ã¤Ê¤¤¤«¡ª¤³¤³¤«¤é½Ð¤Æ¹Ô¤±¡ª");
1661 msg_print("Hey! You don't have the gold - get out of here!");
1669 } while ((again == 'y') || (again == 'Y'));
1672 if (p_ptr->au >= oldgold)
1675 msg_print("¡Öº£²ó¤ÏÌÙ¤±¤¿¤Ê¡ª¤Ç¤â¼¡¤Ï¤³¤Ã¤Á¤¬¾¡¤Ã¤Æ¤ä¤ë¤«¤é¤Ê¡¢ÀäÂФˡª¡×");
1677 msg_print("You came out a winner! We'll win next time, I'm sure.");
1679 chg_virtue(V_CHANCE, 3);
1684 msg_print("¡Ö¶â¤ò¥¹¥Ã¤Æ¤·¤Þ¤Ã¤¿¤Ê¡¢¤ï¤Ï¤Ï¡ª¤¦¤Á¤Ëµ¢¤Ã¤¿Êý¤¬¤¤¤¤¤¼¡£¡×");
1686 msg_print("You lost gold! Haha, better head home.");
1688 chg_virtue(V_CHANCE, -3);
1697 static bool vault_aux_battle(int r_idx)
1702 monster_race *r_ptr = &r_info[r_idx];
1704 /* Decline town monsters */
1705 /* if (!mon_hook_dungeon(r_idx)) return FALSE; */
1707 /* Decline unique monsters */
1708 /* if (r_ptr->flags1 & (RF1_UNIQUE)) return (FALSE); */
1709 /* if (r_ptr->flags7 & (RF7_NAZGUL)) return (FALSE); */
1711 if (r_ptr->flags1 & (RF1_NEVER_MOVE)) return (FALSE);
1712 if (r_ptr->flags2 & (RF2_MULTIPLY)) return (FALSE);
1713 if (r_ptr->flags2 & (RF2_QUANTUM)) return (FALSE);
1714 if (r_ptr->flags7 & (RF7_AQUATIC)) return (FALSE);
1715 if (r_ptr->flags7 & (RF7_CHAMELEON)) return (FALSE);
1717 for (i = 0; i < 4; i++)
1719 if (r_ptr->blow[i].method == RBM_EXPLODE) return (FALSE);
1720 if (r_ptr->blow[i].effect != RBE_DR_MANA) dam += r_ptr->blow[i].d_dice;
1722 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);
1728 void battle_monsters(void)
1735 bool old_inside_battle = p_ptr->inside_battle;
1737 for (i = 0; i < max_d_idx; i++)
1738 if (max_dl < max_dlv[i]) max_dl = max_dlv[i];
1740 mon_level = randint1(MIN(max_dl, 122))+5;
1741 if (randint0(100) < 60)
1743 i = randint1(MIN(max_dl, 122))+5;
1744 mon_level = MAX(i, mon_level);
1746 if (randint0(100) < 30)
1748 i = randint1(MIN(max_dl, 122))+5;
1749 mon_level = MAX(i, mon_level);
1761 get_mon_num_prep(vault_aux_battle, NULL);
1762 p_ptr->inside_battle = TRUE;
1763 r_idx = get_mon_num(mon_level);
1764 p_ptr->inside_battle = old_inside_battle;
1765 if (!r_idx) continue;
1767 if ((r_info[r_idx].flags1 & RF1_UNIQUE) || (r_info[r_idx].flags7 & RF7_UNIQUE2))
1769 if ((r_info[r_idx].level + 10) > mon_level) continue;
1772 for (j = 0; j < i; j++)
1773 if(r_idx == battle_mon[j]) break;
1778 battle_mon[i] = r_idx;
1779 if (r_info[r_idx].level < 45) tekitou = TRUE;
1784 monster_race *r_ptr = &r_info[battle_mon[i]];
1785 int num_taisei = count_bits(r_ptr->flagsr & (RFR_IM_ACID | RFR_IM_ELEC | RFR_IM_FIRE | RFR_IM_COLD | RFR_IM_POIS));
1787 if (r_ptr->flags1 & RF1_FORCE_MAXHP)
1788 power[i] = r_ptr->hdice * r_ptr->hside * 2;
1790 power[i] = r_ptr->hdice * (r_ptr->hside + 1);
1791 power[i] = power[i] * (100 + r_ptr->level) / 100;
1792 if (r_ptr->speed > 110)
1793 power[i] = power[i] * (r_ptr->speed * 2 - 110) / 100;
1794 if (r_ptr->speed < 110)
1795 power[i] = power[i] * (r_ptr->speed - 20) / 100;
1797 power[i] = power[i] * (num_taisei*2+5) / 10;
1798 else if (r_ptr->flags6 & RF6_INVULNER)
1799 power[i] = power[i] * 4 / 3;
1800 else if (r_ptr->flags6 & RF6_HEAL)
1801 power[i] = power[i] * 4 / 3;
1802 else if (r_ptr->flags5 & RF5_DRAIN_MANA)
1803 power[i] = power[i] * 11 / 10;
1804 if (r_ptr->flags1 & RF1_RAND_25)
1805 power[i] = power[i] * 9 / 10;
1806 if (r_ptr->flags1 & RF1_RAND_50)
1807 power[i] = power[i] * 9 / 10;
1809 switch (battle_mon[i])
1820 case MON_UND_BEHOLDER:
1821 case MON_SANTACLAUS:
1822 case MON_ULT_BEHOLDER:
1824 case MON_ATLACH_NACHA:
1826 power[i] = power[i] * 3 / 5;
1828 case MON_ROBIN_HOOD:
1832 case MON_CRYPT_THING:
1833 case MON_MASTER_LICH:
1834 case MON_DREADMASTER:
1836 case MON_SHADOWLORD:
1841 case MON_VENOM_WYRM:
1842 case MON_MASTER_MYS:
1843 case MON_G_MASTER_MYS:
1844 power[i] = power[i] * 3 / 4;
1846 case MON_VORPAL_BUNNY:
1849 case MON_LOG_MASTER:
1851 case MON_GRAV_HOUND:
1854 case MON_CLUB_DEMON:
1856 case MON_NIGHTCRAWLER:
1857 case MON_NIGHTWALKER:
1863 case MON_SPECT_WYRM:
1868 power[i] = power[i] * 4 / 3;
1870 case MON_UMBER_HULK:
1874 case MON_ENERGY_VOR:
1878 case MON_PLASMA_VOR:
1883 case MON_STORMBRINGER:
1884 case MON_TIME_HOUND:
1885 case MON_PLASMA_HOUND:
1888 case MON_AETHER_VOR:
1889 case MON_AETHER_HOUND:
1897 case MON_D_ELF_SHADE:
1898 case MON_MANA_HOUND:
1900 case MON_BANORLUPART:
1905 power[i] = power[i] * 3 / 2;
1909 case MON_CYBER_KING:
1910 case MON_UNICORN_ORD:
1911 power[i] = power[i] * 5 / 3;
1915 case MON_WYRM_POWER:
1935 power[i] = total*60/power[i];
1936 if (tekitou && ((power[i] < 160) || power[i] > 1500)) break;
1937 if ((power[i] < 160) && randint0(20)) break;
1938 if (power[i] < 101) power[i] = 100 + randint1(5);
1939 mon_odds[i] = power[i];
1945 static bool kakutoujou(void)
1949 char out_val[160], tmp_str[80];
1952 if ((turn - old_battle) > TURNS_PER_TICK*250)
1964 msg_print("¤ª¤¤¡ª¤ª¤Þ¤¨°ìʸ¤Ê¤·¤¸¤ã¤Ê¤¤¤«¡ª¤³¤Ã¤«¤é½Ð¤Æ¤¤¤±¡ª");
1966 msg_print("Hey! You don't have gold - get out of here!");
1980 prt("¥â¥ó¥¹¥¿¡¼ ÇÜΨ", 4, 4);
1982 prt("Monsters Odds", 4, 4);
1987 monster_race *r_ptr = &r_info[battle_mon[i]];
1990 sprintf(buf,"%d) %-58s %4ld.%02ldÇÜ", i+1, format("%s%s",r_name + r_ptr->name, (r_ptr->flags1 & RF1_UNIQUE) ? "¤â¤É¤" : " "), (long int)mon_odds[i]/100, (long int)mon_odds[i]%100);
1992 sprintf(buf,"%d) %-58s %4ld.%02ld", i+1, format("%s%s", (r_ptr->flags1 & RF1_UNIQUE) ? "Fake " : "", r_name + r_ptr->name), (long int)mon_odds[i]/100, (long int)mon_odds[i]%100);
1998 prt("¤É¤ì¤ËÅÒ¤±¤Þ¤¹¤«:", 0, 0);
2000 prt("Which monster: ", 0, 0);
2011 if (i >= '1' && i <= '4')
2013 sel_monster = i-'1';
2014 battle_odds = mon_odds[sel_monster];
2022 if (i !=sel_monster) clear_bldg(i+5,i+5);
2024 maxbet = p_ptr->lev * 200;
2026 /* We can't bet more than we have */
2027 maxbet = MIN(maxbet, p_ptr->au);
2030 strcpy(out_val, "");
2032 sprintf(tmp_str,"ÅÒ¤±¶â (1-%ld)¡©", (long int)maxbet);
2034 sprintf(tmp_str,"Your wager (1-%ld) ? ", (long int)maxbet);
2039 * Use get_string() because we may need more than
2040 * the s16b value returned by get_quantity().
2042 if (get_string(tmp_str, out_val, 32))
2045 for (p = out_val; *p == ' '; p++);
2050 if (wager > p_ptr->au)
2053 msg_print("¤ª¤¤¡ª¶â¤¬Â¤ê¤Ê¤¤¤¸¤ã¤Ê¤¤¤«¡ª½Ð¤Æ¤¤¤±¡ª");
2055 msg_print("Hey! You don't have the gold - get out of here!");
2062 else if (wager > maxbet)
2065 msg_format("%ld¥´¡¼¥ë¥É¤À¤±¼õ¤±¤è¤¦¡£»Ä¤ê¤Ï¼è¤Ã¤È¤¤Ê¡£", (long int)maxbet);
2067 msg_format("I'll take %ld gold of that. Keep the rest.",(long int) maxbet);
2075 msg_print("£Ï£Ë¡¢£±¥´¡¼¥ë¥É¤Ç¤¤¤³¤¦¡£");
2077 msg_print("Ok, we'll start with 1 gold.");
2084 battle_odds = MAX(wager+1, wager * battle_odds / 100);
2089 /* Save the surface floor as saved floor */
2090 prepare_change_floor_mode(CFM_SAVE_FLOORS);
2092 p_ptr->inside_battle = TRUE;
2093 p_ptr->leaving = TRUE;
2106 static void today_target(void)
2109 monster_race *r_ptr = &r_info[today_mon];
2113 c_put_str(TERM_YELLOW, "ËÜÆü¤Î¾Þ¶â¼ó", 5, 10);
2115 prt("Wanted monster that changes from day to day", 5, 10);
2118 sprintf(buf,"¥¿¡¼¥²¥Ã¥È¡§ %s",r_name + r_ptr->name);
2120 sprintf(buf,"target: %s",r_name + r_ptr->name);
2122 c_put_str(TERM_YELLOW, buf, 6, 10);
2124 sprintf(buf,"»àÂÎ ---- $%d",r_ptr->level * 50 + 100);
2126 sprintf(buf,"corpse ---- $%d",r_ptr->level * 50 + 100);
2130 sprintf(buf,"¹ü ---- $%d",r_ptr->level * 30 + 60);
2132 sprintf(buf,"skeleton ---- $%d",r_ptr->level * 30 + 60);
2135 p_ptr->today_mon = today_mon;
2138 static void tsuchinoko(void)
2142 c_put_str(TERM_YELLOW, "°ì³ÍÀé¶â¤ÎÂç¥Á¥ã¥ó¥¹¡ª¡ª¡ª", 5, 10);
2143 c_put_str(TERM_YELLOW, "¥¿¡¼¥²¥Ã¥È¡§¸¸¤ÎÄÁ½Ã¡Ö¥Ä¥Á¥Î¥³¡×", 6, 10);
2144 c_put_str(TERM_WHITE, "À¸¤±Êá¤ê ---- $1,000,000", 8, 10);
2145 c_put_str(TERM_WHITE, "»àÂÎ ---- $200,000", 9, 10);
2146 c_put_str(TERM_WHITE, "¹ü ---- $100,000", 10, 10);
2148 c_put_str(TERM_YELLOW, "Big chance to quick money!!!", 5, 10);
2149 c_put_str(TERM_YELLOW, "target: the rarest animal 'Tsuchinoko'", 6, 10);
2150 c_put_str(TERM_WHITE, "catch alive ---- $1,000,000", 8, 10);
2151 c_put_str(TERM_WHITE, "corpse ---- $200,000", 9, 10);
2152 c_put_str(TERM_WHITE, "bones ---- $100,000", 10, 10);
2156 static void shoukinkubi(void)
2164 prt("»àÂΤò»ý¤Áµ¢¤ì¤ÐÊó½·¤òº¹¤·¾å¤²¤Þ¤¹¡£",4 ,10);
2165 c_put_str(TERM_YELLOW, "¸½ºß¤Î¾Þ¶â¼ó", 6, 10);
2167 prt("Offer a prize when you bring a wanted monster's corpse",4 ,10);
2168 c_put_str(TERM_YELLOW, "Wanted monsters", 6, 10);
2171 for (i = 0; i < MAX_KUBI; i++)
2175 monster_race *r_ptr = &r_info[(kubi_r_idx[i] > 10000 ? kubi_r_idx[i] - 10000 : kubi_r_idx[i])];
2177 if (kubi_r_idx[i] > 10000)
2183 done_mark = "(done)";
2192 c_prt(color, format("%s %s", r_name + r_ptr->name, done_mark), y+7, 10);
2195 if (!y && (i < MAX_KUBI -1))
2198 prt("²¿¤«¥¡¼¤ò²¡¤·¤Æ¤¯¤À¤µ¤¤", 0, 0);
2200 prt("Hit any key.", 0, 0);
2210 /* List of prize object */
2214 } prize_list[MAX_KUBI] =
2216 {TV_POTION, SV_POTION_CURING},
2217 {TV_POTION, SV_POTION_SPEED},
2218 {TV_POTION, SV_POTION_SPEED},
2219 {TV_POTION, SV_POTION_RESISTANCE},
2220 {TV_POTION, SV_POTION_ENLIGHTENMENT},
2222 {TV_POTION, SV_POTION_HEALING},
2223 {TV_POTION, SV_POTION_RESTORE_MANA},
2224 {TV_SCROLL, SV_SCROLL_STAR_DESTRUCTION},
2225 {TV_POTION, SV_POTION_STAR_ENLIGHTENMENT},
2226 {TV_SCROLL, SV_SCROLL_SUMMON_PET},
2228 {TV_SCROLL, SV_SCROLL_GENOCIDE},
2229 {TV_POTION, SV_POTION_STAR_HEALING},
2230 {TV_POTION, SV_POTION_STAR_HEALING},
2231 {TV_POTION, SV_POTION_NEW_LIFE},
2232 {TV_SCROLL, SV_SCROLL_MASS_GENOCIDE},
2234 {TV_POTION, SV_POTION_LIFE},
2235 {TV_POTION, SV_POTION_LIFE},
2236 {TV_POTION, SV_POTION_AUGMENTATION},
2237 {TV_POTION, SV_POTION_INVULNERABILITY},
2238 {TV_SCROLL, SV_SCROLL_ARTIFACT},
2243 static bool kankin(void)
2246 bool change = FALSE;
2247 char o_name[MAX_NLEN];
2250 /* Loop for inventory and right/left arm */
2251 for (i = 0; i <= INVEN_LARM; i++)
2253 o_ptr = &inventory[i];
2255 /* Living Tsuchinoko worthes $1000000 */
2256 if ((o_ptr->tval == TV_CAPTURE) && (o_ptr->pval == MON_TSUCHINOKO))
2258 char buf[MAX_NLEN+20];
2259 object_desc(o_name, o_ptr, 0);
2261 sprintf(buf, "%s ¤ò´¹¶â¤·¤Þ¤¹¤«¡©",o_name);
2263 sprintf(buf, "Convert %s into money? ",o_name);
2268 msg_format("¾Þ¶â %ld¡ð¤ò¼ê¤ËÆþ¤ì¤¿¡£", (long int)(1000000L * o_ptr->number));
2270 msg_format("You get %ldgp.", (long int)(1000000L * o_ptr->number));
2272 p_ptr->au += 1000000L * o_ptr->number;
2273 p_ptr->redraw |= (PR_GOLD);
2274 inven_item_increase(i, -o_ptr->number);
2275 inven_item_describe(i);
2276 inven_item_optimize(i);
2282 for (i = 0; i < INVEN_PACK; i++)
2284 o_ptr = &inventory[i];
2286 /* Corpse of Tsuchinoko worthes $200000 */
2287 if ((o_ptr->tval == TV_CORPSE) && (o_ptr->sval == SV_CORPSE) && (o_ptr->pval == MON_TSUCHINOKO))
2289 char buf[MAX_NLEN+20];
2290 object_desc(o_name, o_ptr, 0);
2292 sprintf(buf, "%s ¤ò´¹¶â¤·¤Þ¤¹¤«¡©",o_name);
2294 sprintf(buf, "Convert %s into money? ",o_name);
2299 msg_format("¾Þ¶â %ld¡ð¤ò¼ê¤ËÆþ¤ì¤¿¡£", (long int)(200000L * o_ptr->number));
2301 msg_format("You get %ldgp.", (long int)(200000L * o_ptr->number));
2303 p_ptr->au += 200000L * o_ptr->number;
2304 p_ptr->redraw |= (PR_GOLD);
2305 inven_item_increase(i, -o_ptr->number);
2306 inven_item_describe(i);
2307 inven_item_optimize(i);
2313 for (i = 0; i < INVEN_PACK; i++)
2315 o_ptr = &inventory[i];
2317 /* Bones of Tsuchinoko worthes $100000 */
2318 if ((o_ptr->tval == TV_CORPSE) && (o_ptr->sval == SV_SKELETON) && (o_ptr->pval == MON_TSUCHINOKO))
2320 char buf[MAX_NLEN+20];
2321 object_desc(o_name, o_ptr, 0);
2323 sprintf(buf, "%s ¤ò´¹¶â¤·¤Þ¤¹¤«¡©",o_name);
2325 sprintf(buf, "Convert %s into money? ",o_name);
2330 msg_format("¾Þ¶â %ld¡ð¤ò¼ê¤ËÆþ¤ì¤¿¡£", (long int)(100000L * o_ptr->number));
2332 msg_format("You get %ldgp.", (long int)(100000L * o_ptr->number));
2334 p_ptr->au += 100000L * o_ptr->number;
2335 p_ptr->redraw |= (PR_GOLD);
2336 inven_item_increase(i, -o_ptr->number);
2337 inven_item_describe(i);
2338 inven_item_optimize(i);
2344 for (i = 0; i < INVEN_PACK; i++)
2346 o_ptr = &inventory[i];
2347 if ((o_ptr->tval == TV_CORPSE) && (o_ptr->sval == SV_CORPSE) && (streq(r_name + r_info[o_ptr->pval].name, r_name + r_info[today_mon].name)))
2349 char buf[MAX_NLEN+20];
2350 object_desc(o_name, o_ptr, 0);
2352 sprintf(buf, "%s ¤ò´¹¶â¤·¤Þ¤¹¤«¡©",o_name);
2354 sprintf(buf, "Convert %s into money? ",o_name);
2359 msg_format("¾Þ¶â %ld¡ð¤ò¼ê¤ËÆþ¤ì¤¿¡£", (long int)((r_info[today_mon].level * 50 + 100) * o_ptr->number));
2361 msg_format("You get %ldgp.", (long int)((r_info[today_mon].level * 50 + 100) * o_ptr->number));
2363 p_ptr->au += (r_info[today_mon].level * 50 + 100) * o_ptr->number;
2364 p_ptr->redraw |= (PR_GOLD);
2365 inven_item_increase(i, -o_ptr->number);
2366 inven_item_describe(i);
2367 inven_item_optimize(i);
2373 for (i = 0; i < INVEN_PACK; i++)
2375 o_ptr = &inventory[i];
2377 if ((o_ptr->tval == TV_CORPSE) && (o_ptr->sval == SV_SKELETON) && (streq(r_name + r_info[o_ptr->pval].name, r_name + r_info[today_mon].name)))
2379 char buf[MAX_NLEN+20];
2380 object_desc(o_name, o_ptr, 0);
2382 sprintf(buf, "%s ¤ò´¹¶â¤·¤Þ¤¹¤«¡©",o_name);
2384 sprintf(buf, "Convert %s into money? ",o_name);
2389 msg_format("¾Þ¶â %ld¡ð¤ò¼ê¤ËÆþ¤ì¤¿¡£", (long int)((r_info[today_mon].level * 30 + 60) * o_ptr->number));
2391 msg_format("You get %ldgp.", (long int)((r_info[today_mon].level * 30 + 60) * o_ptr->number));
2393 p_ptr->au += (r_info[today_mon].level * 30 + 60) * o_ptr->number;
2394 p_ptr->redraw |= (PR_GOLD);
2395 inven_item_increase(i, -o_ptr->number);
2396 inven_item_describe(i);
2397 inven_item_optimize(i);
2403 for (j = 0; j < MAX_KUBI; j++)
2405 /* Need reverse order --- Positions will be changed in the loop */
2406 for (i = INVEN_PACK-1; i >= 0; i--)
2408 o_ptr = &inventory[i];
2409 if ((o_ptr->tval == TV_CORPSE) && (o_ptr->pval == kubi_r_idx[j]))
2411 char buf[MAX_NLEN+20];
2412 int num, k, item_new;
2415 object_desc(o_name, o_ptr, 0);
2417 sprintf(buf, "%s¤òÅϤ·¤Þ¤¹¤«¡©",o_name);
2419 sprintf(buf, "Hand %s over? ",o_name);
2421 if (!get_check(buf)) continue;
2423 #if 0 /* Obsoleted */
2425 msg_format("¾Þ¶â %ld¡ð¤ò¼ê¤ËÆþ¤ì¤¿¡£", (r_info[kubi_r_idx[j]].level + 1) * 300 * o_ptr->number);
2427 msg_format("You get %ldgp.", (r_info[kubi_r_idx[j]].level + 1) * 300 * o_ptr->number);
2429 p_ptr->au += (r_info[kubi_r_idx[j]].level+1) * 300 * o_ptr->number;
2430 p_ptr->redraw |= (PR_GOLD);
2431 inven_item_increase(i, -o_ptr->number);
2432 inven_item_describe(i);
2433 inven_item_optimize(i);
2434 chg_virtue(V_JUSTICE, 5);
2435 kubi_r_idx[j] += 10000;
2438 #endif /* Obsoleted */
2441 inven_item_increase(i, -o_ptr->number);
2442 inven_item_describe(i);
2443 inven_item_optimize(i);
2445 chg_virtue(V_JUSTICE, 5);
2446 kubi_r_idx[j] += 10000;
2448 /* Count number of unique corpses already handed */
2449 for (num = 0, k = 0; k < MAX_KUBI; k++)
2451 if (kubi_r_idx[k] >= 10000) num++;
2455 msg_format("¤³¤ì¤Ç¹ç·× %d ¥Ý¥¤¥ó¥È³ÍÆÀ¤·¤Þ¤·¤¿¡£", num);
2457 msg_format("You earned %d point%s total.", num, (num > 1 ? "s" : ""));
2460 /* Prepare to make a prize */
2461 object_prep(&forge, lookup_kind(prize_list[num-1].tval, prize_list[num-1].sval));
2462 apply_magic(&forge, object_level, AM_NO_FIXED_ART);
2464 /* Identify it fully */
2465 object_aware(&forge);
2466 object_known(&forge);
2469 * Hand it --- Assume there is an empty slot.
2470 * Since a corpse is handed at first,
2471 * there is at least one empty slot.
2473 item_new = inven_carry(&forge);
2475 /* Describe the object */
2476 object_desc(o_name, &forge, 0);
2478 msg_format("%s(%c)¤òÌã¤Ã¤¿¡£", o_name, index_to_label(item_new));
2480 msg_format("You get %s (%c). ", o_name, index_to_label(item_new));
2483 /* Auto-inscription */
2484 autopick_alter_item(item_new, FALSE);
2497 msg_print("¾Þ¶â¤òÆÀ¤é¤ì¤½¤¦¤Ê¤â¤Î¤Ï»ý¤Ã¤Æ¤¤¤Ê¤«¤Ã¤¿¡£");
2499 msg_print("You have nothing.");
2507 bool get_nightmare(int r_idx)
2509 monster_race *r_ptr = &r_info[r_idx];
2511 /* Require eldritch horrors */
2512 if (!(r_ptr->flags2 & (RF2_ELDRITCH_HORROR))) return (FALSE);
2514 /* Require high level */
2515 if (r_ptr->level <= p_ptr->lev) return (FALSE);
2517 /* Accept this monster */
2522 void have_nightmare(int r_idx)
2524 bool happened = FALSE;
2525 monster_race *r_ptr = &r_info[r_idx];
2526 int power = r_ptr->level + 10;
2528 cptr desc = r_name + r_ptr->name;
2532 if (!(r_ptr->flags1 & RF1_UNIQUE))
2533 sprintf(m_name, "%s %s", (is_a_vowel(desc[0]) ? "an" : "a"), desc);
2536 sprintf(m_name, "%s", desc);
2538 if (!(r_ptr->flags1 & RF1_UNIQUE))
2540 if (r_ptr->flags1 & RF1_FRIENDS) power /= 2;
2544 if (saving_throw(p_ptr->skill_sav * 100 / power))
2547 msg_format("Ì´¤ÎÃæ¤Ç%s¤ËÄɤ¤¤«¤±¤é¤ì¤¿¡£", m_name);
2549 msg_format("%^s chases you through your dreams.", m_name);
2558 /* Something silly happens... */
2560 msg_format("%s%s¤Î´é¤ò¸«¤Æ¤·¤Þ¤Ã¤¿¡ª",
2562 msg_format("You behold the %s visage of %s!",
2565 funny_desc[randint0(MAX_SAN_FUNNY)], m_name);
2569 msg_print(funny_comments[randint0(MAX_SAN_COMMENT)]);
2570 p_ptr->image = p_ptr->image + randint1(r_ptr->level);
2573 /* Never mind; we can't see it clearly enough */
2577 /* Something frightening happens... */
2579 msg_format("%s%s¤Î´é¤ò¸«¤Æ¤·¤Þ¤Ã¤¿¡ª",
2581 msg_format("You behold the %s visage of %s!",
2584 horror_desc[randint0(MAX_SAN_HORROR)], desc);
2586 r_ptr->r_flags2 |= RF2_ELDRITCH_HORROR;
2588 if (!p_ptr->mimic_form)
2590 switch (p_ptr->prace)
2592 /* Demons may make a saving throw */
2595 if (saving_throw(20 + p_ptr->lev)) return;
2597 /* Undead may make a saving throw */
2602 if (saving_throw(10 + p_ptr->lev)) return;
2608 /* Demons may make a saving throw */
2609 if (mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_DEMON)
2611 if (saving_throw(20 + p_ptr->lev)) return;
2613 /* Undead may make a saving throw */
2614 else if (mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_UNDEAD)
2616 if (saving_throw(10 + p_ptr->lev)) return;
2621 if (!saving_throw(p_ptr->skill_sav * 100 / power))
2623 if (!p_ptr->resist_conf)
2625 (void)set_confused(p_ptr->confused + randint0(4) + 4);
2627 if (!p_ptr->resist_chaos && one_in_(3))
2629 (void)set_image(p_ptr->image + randint0(250) + 150);
2634 /* Lose int & wis */
2635 if (!saving_throw(p_ptr->skill_sav * 100 / power))
2643 if (!saving_throw(p_ptr->skill_sav * 100 / power))
2645 if (!p_ptr->resist_conf)
2647 (void)set_confused(p_ptr->confused + randint0(4) + 4);
2649 if (!p_ptr->free_act)
2651 (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
2653 while (!saving_throw(p_ptr->skill_sav))
2655 (void)do_dec_stat(A_INT);
2657 while (!saving_throw(p_ptr->skill_sav))
2659 (void)do_dec_stat(A_WIS);
2661 if (!p_ptr->resist_chaos)
2663 (void)set_image(p_ptr->image + randint0(250) + 150);
2670 if (!saving_throw(p_ptr->skill_sav * 100 / power))
2672 if (lose_all_info())
2675 msg_print("¤¢¤Þ¤ê¤Î¶²ÉݤËÁ´¤Æ¤Î¤³¤È¤ò˺¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª");
2677 msg_print("You forget everything in your utmost terror!");
2684 /* Else gain permanent insanity */
2685 if ((p_ptr->muta3 & MUT3_MORONIC) && (p_ptr->muta2 & MUT2_BERS_RAGE) &&
2686 ((p_ptr->muta2 & MUT2_COWARDICE) || (p_ptr->resist_fear)) &&
2687 ((p_ptr->muta2 & MUT2_HALLU) || (p_ptr->resist_chaos)))
2689 /* The poor bastard already has all possible insanities! */
2695 switch (randint1(4))
2699 if (!(p_ptr->muta3 & MUT3_MORONIC))
2701 if ((p_ptr->stat_use[A_INT] < 4) && (p_ptr->stat_use[A_WIS] < 4))
2704 msg_print("¤¢¤Ê¤¿¤Ï´°àú¤ÊÇϼ¯¤Ë¤Ê¤Ã¤¿¤è¤¦¤Êµ¤¤¬¤·¤¿¡£¤·¤«¤·¤½¤ì¤Ï¸µ¡¹¤À¤Ã¤¿¡£");
2706 msg_print("You turn into an utter moron!");
2712 msg_print("¤¢¤Ê¤¿¤Ï´°àú¤ÊÇϼ¯¤Ë¤Ê¤Ã¤¿¡ª");
2714 msg_print("You turn into an utter moron!");
2718 if (p_ptr->muta3 & MUT3_HYPER_INT)
2721 msg_print("¤¢¤Ê¤¿¤ÎǾ¤ÏÀ¸ÂÎ¥³¥ó¥Ô¥å¡¼¥¿¤Ç¤Ï¤Ê¤¯¤Ê¤Ã¤¿¡£");
2723 msg_print("Your brain is no longer a living computer.");
2726 p_ptr->muta3 &= ~(MUT3_HYPER_INT);
2728 p_ptr->muta3 |= MUT3_MORONIC;
2735 if (!(p_ptr->muta2 & MUT2_COWARDICE) && !p_ptr->resist_fear)
2738 msg_print("¤¢¤Ê¤¿¤Ï¥Ñ¥é¥Î¥¤¥¢¤Ë¤Ê¤Ã¤¿¡ª");
2740 msg_print("You become paranoid!");
2744 /* Duh, the following should never happen, but anyway... */
2745 if (p_ptr->muta3 & MUT3_FEARLESS)
2748 msg_print("¤¢¤Ê¤¿¤Ï¤â¤¦¶²¤ìÃΤ餺¤Ç¤Ï¤Ê¤¯¤Ê¤Ã¤¿¡£");
2750 msg_print("You are no longer fearless.");
2753 p_ptr->muta3 &= ~(MUT3_FEARLESS);
2756 p_ptr->muta2 |= MUT2_COWARDICE;
2763 if (!(p_ptr->muta2 & MUT2_HALLU) && !p_ptr->resist_chaos)
2766 msg_print("¸¸³Ð¤ò¤Ò¤µ¯¤³¤¹Àº¿ÀºøÍð¤Ë´Ù¤Ã¤¿¡ª");
2768 msg_print("You are afflicted by a hallucinatory insanity!");
2771 p_ptr->muta2 |= MUT2_HALLU;
2778 if (!(p_ptr->muta2 & MUT2_BERS_RAGE))
2781 msg_print("·ãÎõ¤Ê´¶¾ð¤Îȯºî¤Ë¤ª¤½¤ï¤ì¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¡ª");
2783 msg_print("You become subject to fits of berserk rage!");
2786 p_ptr->muta2 |= MUT2_BERS_RAGE;
2794 p_ptr->update |= PU_BONUS;
2801 * Note that resting for the night was a perfect way to avoid player
2802 * ghosts in the town *if* you could only make it to the inn in time (-:
2803 * Now that the ghosts are temporarily disabled in 2.8.X, this function
2804 * will not be that useful. I will keep it in the hopes the player
2805 * ghost code does become a reality again. Does help to avoid filthy urchins.
2806 * Resting at night is also a quick way to restock stores -KMW-
2808 static bool inn_comm(int cmd)
2812 case BACT_FOOD: /* Buy food & drink */
2813 if (p_ptr->food >= PY_FOOD_FULL)
2816 msg_print("º£¤ÏËþÊ¢¤À¡£");
2818 msg_print("You are full now.");
2824 msg_print("¥Ð¡¼¥Æ¥ó¤Ï¤¤¤¯¤é¤«¤Î¿©¤Ùʪ¤È¥Ó¡¼¥ë¤ò¤¯¤ì¤¿¡£");
2826 msg_print("The barkeep gives you some gruel and a beer.");
2829 (void)set_food(PY_FOOD_MAX - 1);
2832 case BACT_REST: /* Rest for the night */
2833 if ((p_ptr->poisoned) || (p_ptr->cut))
2836 msg_print("¤¢¤Ê¤¿¤ËɬÍפʤΤÏÉô²°¤Ç¤Ï¤Ê¤¯¡¢¼£ÎżԤǤ¹¡£");
2838 msg_print("You need a healer, not a room.");
2843 msg_print("¤¹¤ß¤Þ¤»¤ó¡¢¤Ç¤â¤¦¤Á¤Ç狼¤Ë»à¤Ê¤ì¤Á¤ãº¤¤ê¤Þ¤¹¤ó¤Ç¡£");
2845 msg_print("Sorry, but don't want anyone dying in here.");
2850 s32b oldturn = turn;
2851 int prev_day, prev_hour, prev_min;
2853 extract_day_hour_min(&prev_day, &prev_hour, &prev_min);
2855 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "½É²°¤ËÇñ¤Þ¤Ã¤¿¡£");
2857 if ((prev_hour >= 6) && (prev_hour <= 17)) do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "stay over daytime at the inn.");
2858 else do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "stay over night at the inn.");
2860 turn = (turn / (TURNS_PER_TICK*TOWN_DAWN/2) + 1) * (TURNS_PER_TICK*TOWN_DAWN/2);
2861 if (dungeon_turn < dungeon_turn_limit)
2863 dungeon_turn += MIN(turn - oldturn, TURNS_PER_TICK * 250);
2864 if (dungeon_turn > dungeon_turn_limit) dungeon_turn = dungeon_turn_limit;
2867 prevent_turn_overflow();
2869 if ((prev_hour >= 18) && (prev_hour <= 23)) do_cmd_write_nikki(NIKKI_HIGAWARI, 0, NULL);
2870 p_ptr->chp = p_ptr->mhp;
2872 if (ironman_nightmare)
2875 msg_print("̲¤ê¤Ë½¢¤¯¤È¶²¤í¤·¤¤¸÷·Ê¤¬¿´¤ò¤è¤®¤Ã¤¿¡£");
2877 msg_print("Horrible visions flit through your mind as you sleep.");
2880 /* Pick a nightmare */
2881 get_mon_num_prep(get_nightmare, NULL);
2883 /* Have some nightmares */
2886 have_nightmare(get_mon_num(MAX_DEPTH));
2888 if (!one_in_(3)) break;
2891 /* Remove the monster restriction */
2892 get_mon_num_prep(NULL, NULL);
2895 msg_print("¤¢¤Ê¤¿¤ÏÀ䶫¤·¤ÆÌܤò³Ð¤Þ¤·¤¿¡£");
2896 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "°Ì´¤Ë¤¦¤Ê¤µ¤ì¤Æ¤è¤¯Ì²¤ì¤Ê¤«¤Ã¤¿¡£");
2898 msg_print("You awake screaming.");
2899 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "be troubled by a nightmare.");
2907 p_ptr->chp = p_ptr->mhp;
2908 p_ptr->csp = p_ptr->msp;
2909 if (p_ptr->pclass == CLASS_MAGIC_EATER)
2912 for (i = 0; i < 72; i++)
2914 p_ptr->magic_num1[i] = p_ptr->magic_num2[i]*EATER_CHARGE;
2916 for (; i < 108; i++)
2918 p_ptr->magic_num1[i] = 0;
2922 if ((prev_hour >= 6) && (prev_hour <= 17))
2925 msg_print("¤¢¤Ê¤¿¤Ï¥ê¥Õ¥ì¥Ã¥·¥å¤·¤ÆÌܳФᡢͼÊý¤ò·Þ¤¨¤¿¡£");
2926 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "ͼÊý¤ò·Þ¤¨¤¿¡£");
2928 msg_print("You awake refreshed for the evening.");
2929 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "awake refreshed.");
2935 msg_print("¤¢¤Ê¤¿¤Ï¥ê¥Õ¥ì¥Ã¥·¥å¤·¤ÆÌܳФᡢ¿·¤¿¤ÊÆü¤ò·Þ¤¨¤¿¡£");
2936 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "¤¹¤¬¤¹¤¬¤·¤¤Ä«¤ò·Þ¤¨¤¿¡£");
2938 msg_print("You awake refreshed for the new day.");
2939 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "awake refreshed.");
2946 case BACT_RUMORS: /* Listen for rumors */
2948 display_rumor(TRUE);
2958 * Display quest information
2960 static void get_questinfo(int questnum, bool do_init)
2967 /* Clear the text */
2968 for (i = 0; i < 10; i++)
2970 quest_text[i][0] = '\0';
2973 quest_text_line = 0;
2975 /* Set the quest number temporary */
2976 old_quest = p_ptr->inside_quest;
2977 p_ptr->inside_quest = questnum;
2979 /* Get the quest text */
2980 init_flags = INIT_SHOW_TEXT;
2981 if (do_init) init_flags |= INIT_ASSIGN;
2983 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
2985 /* Reset the old quest number */
2986 p_ptr->inside_quest = old_quest;
2988 /* Print the quest info */
2990 sprintf(tmp_str, "¥¯¥¨¥¹¥È¾ðÊó (´í¸±ÅÙ: %d ³¬ÁêÅö)", quest[questnum].level);
2992 sprintf(tmp_str, "Quest Information (Danger level: %d)", quest[questnum].level);
2997 prt(quest[questnum].name, 7, 0);
2999 for (i = 0; i < 10; i++)
3001 c_put_str(TERM_YELLOW, quest_text[i], i + 8, 0);
3007 * Request a quest from the Lord.
3009 static void castle_quest(void)
3012 monster_race *r_ptr;
3019 /* Current quest of the building */
3020 q_index = cave[py][px].special;
3022 /* Is there a quest available at the building? */
3026 put_str("º£¤Î¤È¤³¤í¥¯¥¨¥¹¥È¤Ï¤¢¤ê¤Þ¤»¤ó¡£", 8, 0);
3028 put_str("I don't have a quest for you at the moment.", 8, 0);
3034 q_ptr = &quest[q_index];
3036 /* Quest is completed */
3037 if (q_ptr->status == QUEST_STATUS_COMPLETED)
3039 /* Rewarded quest */
3040 q_ptr->status = QUEST_STATUS_REWARDED;
3042 get_questinfo(q_index, FALSE);
3044 reinit_wilderness = TRUE;
3047 else if (q_ptr->status == QUEST_STATUS_FAILED)
3049 get_questinfo(q_index, FALSE);
3051 /* Mark quest as done (but failed) */
3052 q_ptr->status = QUEST_STATUS_FAILED_DONE;
3054 reinit_wilderness = TRUE;
3056 /* Quest is still unfinished */
3057 else if (q_ptr->status == QUEST_STATUS_TAKEN)
3060 put_str("¤¢¤Ê¤¿¤Ï¸½ºß¤Î¥¯¥¨¥¹¥È¤ò½ªÎ»¤µ¤»¤Æ¤¤¤Þ¤»¤ó¡ª", 8, 0);
3062 put_str("You have not completed your current quest yet!", 8, 0);
3066 put_str("CTRL-Q¤ò»È¤¨¤Ð¥¯¥¨¥¹¥È¤Î¾õÂÖ¤¬¥Á¥§¥Ã¥¯¤Ç¤¤Þ¤¹¡£", 9, 0);
3068 put_str("Use CTRL-Q to check the status of your quest.", 9, 0);
3072 put_str("¥¯¥¨¥¹¥È¤ò½ª¤ï¤é¤»¤¿¤éÌá¤Ã¤ÆÍè¤Æ²¼¤µ¤¤¡£", 12, 0);
3074 put_str("Return when you have completed your quest.", 12, 0);
3079 else if (q_ptr->status == QUEST_STATUS_UNTAKEN)
3081 q_ptr->status = QUEST_STATUS_TAKEN;
3083 reinit_wilderness = TRUE;
3085 /* Assign a new quest */
3086 if (q_ptr->type == QUEST_TYPE_KILL_ANY_LEVEL)
3088 if (q_ptr->r_idx == 0)
3090 /* Random monster at least 5 - 10 levels out of deep */
3091 q_ptr->r_idx = get_mon_num(q_ptr->level + 4 + randint1(6));
3094 r_ptr = &r_info[q_ptr->r_idx];
3096 while ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->rarity != 1))
3098 q_ptr->r_idx = get_mon_num(q_ptr->level) + 4 + randint1(6);
3099 r_ptr = &r_info[q_ptr->r_idx];
3102 if (q_ptr->max_num == 0)
3104 /* Random monster number */
3105 if (randint1(10) > 7)
3108 q_ptr->max_num = randint1(3) + 1;
3112 name = (r_name + r_ptr->name);
3114 msg_format("¥¯¥¨¥¹¥È: %s¤ò %dÂÎÅݤ¹", name,q_ptr->max_num);
3116 msg_format("Your quest: kill %d %s", q_ptr->max_num, name);
3122 get_questinfo(q_index, TRUE);
3129 * Display town history
3131 static void town_history(void)
3136 /* Peruse the building help file */
3138 (void)show_file(TRUE, "jbldg.txt", NULL, 0, 0);
3140 (void)show_file(TRUE, "bldg.txt", NULL, 0, 0);
3148 /* critical happens at i / 10000 */
3149 s16b calc_crit_ratio_shot(int weight, int plus_ammo, int plus_bow, int dam)
3152 object_type *j_ptr = &inventory[INVEN_BOW];
3154 /* Extract "shot" power */
3155 i = p_ptr->to_h_b + plus_ammo;
3157 if (p_ptr->tval_ammo == TV_BOLT)
3158 i = (p_ptr->skill_thb + (p_ptr->weapon_exp[0][j_ptr->sval] / 400 + i) * BTH_PLUS_ADJ);
3160 i = (p_ptr->skill_thb + ((p_ptr->weapon_exp[0][j_ptr->sval] - (WEAPON_EXP_MASTER / 2)) / 200 + i) * BTH_PLUS_ADJ);
3162 /* Snipers can shot more critically with crossbows */
3163 if (p_ptr->concent) i += ((i * p_ptr->concent) / 5);
3164 if ((p_ptr->pclass == CLASS_SNIPER) && (p_ptr->tval_ammo == TV_BOLT)) i *= 2;
3166 /* Good bow makes more critical */
3167 i += plus_bow * 8 * (p_ptr->concent ? p_ptr->concent + 5 : 5);
3174 s16b calc_expect_crit_shot(int weight, int plus_ammo, int plus_bow, int dam)
3178 i = calc_crit_ratio_shot(weight, plus_ammo, plus_bow, dam);
3183 crit = MIN(500, 900/weight);
3184 num += dam * 3 /2 * crit;
3187 crit = MIN(500, 1350/weight);
3189 num += dam * 2 * crit;
3195 num += dam * 3 * crit;
3201 num += (10000 - i) * dam;
3207 s16b calc_expect_crit(int weight, int plus, int dam, s16b meichuu, bool dokubari)
3212 if(dokubari) return dam;
3214 i = (weight + (meichuu * 3 + plus * 5) + p_ptr->skill_thn);
3220 if (k < 400) num += (2 * dam + 5) * (400 - k);
3221 if (k < 700) num += (2 * dam + 10) * (MIN(700, k + 650) - MAX(400, k));
3222 if (k > (700 - 650) && k < 900) num += (3 * dam + 15) * (MIN(900, k + 650) - MAX(700, k));
3223 if (k > (900 - 650) && k < 1300) num += (3 * dam + 20) * (MIN(1300, k + 650) - MAX(900, k));
3224 if (k > (1300 - 650)) num += (7 * dam / 2 + 25) * MIN(650, k - (1300 - 650));
3227 if(p_ptr->pclass == CLASS_NINJA)
3230 num += (4444 - i) * dam;
3236 num += (5000 - i) * dam;
3243 static s16b calc_slaydam(int dam, int mult, int div, bool force)
3251 tmp += dam * 60 * 2;
3264 static u32b calc_expect_dice(u32b dam, int mult, int div, bool force, int weight, int plus, s16b meichuu, bool dokubari, int vorpal_mult, int vorpal_div)
3266 dam = calc_slaydam(dam, mult, div, force);
3267 dam = calc_expect_crit(weight, plus, dam, meichuu, dokubari);
3268 dam = calc_slaydam(dam, vorpal_mult, vorpal_div, FALSE);
3273 * Display the damage figure of an object
3274 * (used by compare_weapon_aux)
3276 * Only accurate for the current weapon, because it includes
3277 * the current +dam of the player.
3279 static void show_weapon_dmg(int r, int c, int mindice, int maxdice, int blows, int dam_bonus, cptr attr, byte color)
3284 mindam = blows * (mindice + dam_bonus);
3285 maxdam = blows * (maxdice + dam_bonus);
3287 /* Print the intro text */
3288 c_put_str(color, attr, r, c);
3290 /* Calculate the min and max damage figures */
3292 sprintf(tmp_str, "£±¥¿¡¼¥ó: %d-%d ¥À¥á¡¼¥¸",
3294 sprintf(tmp_str, "Attack: %d-%d damage",
3298 /* Print the damage */
3299 put_str(tmp_str, r, c + 8);
3304 * Show the damage figures for the various monster types
3306 * Only accurate for the current weapon, because it includes
3307 * the current number of blows for the player.
3309 static void compare_weapon_aux(object_type *o_ptr, int col, int r)
3311 u32b flgs[TR_FLAG_SIZE];
3312 int blow = p_ptr->num_blow[0];
3314 bool dokubari = FALSE;
3316 /* Effective dices */
3317 int eff_dd = o_ptr->dd + p_ptr->to_dd[0];
3318 int eff_ds = o_ptr->ds + p_ptr->to_ds[0];
3320 int mindice = eff_dd;
3321 int maxdice = eff_ds * eff_dd;
3324 int vorpal_mult = 1;
3326 int dmg_bonus = o_ptr->to_d + p_ptr->to_d[0];
3329 /* Get the flags of the weapon */
3330 object_flags(o_ptr, flgs);
3332 if((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) dokubari = TRUE;
3335 /* Show Critical Damage*/
3336 mindam = calc_expect_crit(o_ptr->weight, o_ptr->to_h, mindice, p_ptr->to_h[0], dokubari);
3337 maxdam = calc_expect_crit(o_ptr->weight, o_ptr->to_h, maxdice, p_ptr->to_h[0], dokubari);
3339 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("²ñ¿´:", "Critical:"), TERM_L_RED);
3343 if ((have_flag(flgs, TR_VORPAL) || hex_spelling(HEX_RUNESWORD)))
3345 if((o_ptr->name1 == ART_VORPAL_BLADE) || (o_ptr->name1 == ART_CHAINSWORD))
3356 mindam = calc_expect_dice(mindice, 1, 1, FALSE, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
3357 maxdam = calc_expect_dice(maxdice, 1, 1, FALSE, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
3358 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("ÀÚ¤ìÌ£:", "Vorpal:") , TERM_L_RED);
3361 if ((p_ptr->pclass != CLASS_SAMURAI) && have_flag(flgs, TR_FORCE_WEAPON) && (p_ptr->csp > (o_ptr->dd * o_ptr->ds / 5)))
3365 mindam = calc_expect_dice(mindice, 1, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
3366 maxdam = calc_expect_dice(maxdice, 1, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
3367 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("ÍýÎÏ:", "Force :"), TERM_L_BLUE);
3370 /* Print the relevant lines */
3371 if (have_flag(flgs, TR_KILL_ANIMAL))
3373 mindam = calc_expect_dice(mindice, 4, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
3374 maxdam = calc_expect_dice(maxdice, 4, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
3375 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("ưʪ:", "Animals:"), TERM_YELLOW);
3377 else if (have_flag(flgs, TR_SLAY_ANIMAL))
3379 mindam = calc_expect_dice(mindice, 5, 2, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
3380 maxdam = calc_expect_dice(maxdice, 5, 2, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
3381 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("ưʪ:", "Animals:"), TERM_YELLOW);
3383 if (have_flag(flgs, TR_KILL_EVIL))
3385 mindam = calc_expect_dice(mindice, 7, 2, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
3386 maxdam = calc_expect_dice(maxdice, 7, 2, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
3387 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("¼Ù°:", "Evil:"), TERM_YELLOW);
3389 else if (have_flag(flgs, TR_SLAY_EVIL))
3391 mindam = calc_expect_dice(mindice, 2, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
3392 maxdam = calc_expect_dice(maxdice, 2, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
3393 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("¼Ù°:", "Evil:"), TERM_YELLOW);
3395 if (have_flag(flgs, TR_KILL_HUMAN))
3397 mindam = calc_expect_dice(mindice, 4, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
3398 maxdam = calc_expect_dice(maxdice, 4, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
3399 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("¿Í´Ö:", "Human:"), TERM_YELLOW);
3401 else if (have_flag(flgs, TR_SLAY_HUMAN))
3403 mindam = calc_expect_dice(mindice, 5, 2, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
3404 maxdam = calc_expect_dice(maxdice, 5, 2, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
3405 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("¿Í´Ö:", "Human:"), TERM_YELLOW);
3407 if (have_flag(flgs, TR_KILL_UNDEAD))
3409 mindam = calc_expect_dice(mindice, 5, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
3410 maxdam = calc_expect_dice(maxdice, 5, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
3411 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("ÉÔ»à:", "Undead:"), TERM_YELLOW);
3413 else if (have_flag(flgs, TR_SLAY_UNDEAD))
3415 mindam = calc_expect_dice(mindice, 3, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
3416 maxdam = calc_expect_dice(maxdice, 3, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
3417 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("ÉÔ»à:", "Undead:"), TERM_YELLOW);
3419 if (have_flag(flgs, TR_KILL_DEMON))
3421 mindam = calc_expect_dice(mindice, 5, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
3422 maxdam = calc_expect_dice(maxdice, 5, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
3423 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("°Ëâ:", "Demons:") , TERM_YELLOW);
3425 else if (have_flag(flgs, TR_SLAY_DEMON))
3427 mindam = calc_expect_dice(mindice, 3, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
3428 maxdam = calc_expect_dice(maxdice, 3, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
3429 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("°Ëâ:", "Demons:") , TERM_YELLOW);
3431 if (have_flag(flgs, TR_KILL_ORC))
3433 mindam = calc_expect_dice(mindice, 5, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
3434 maxdam = calc_expect_dice(maxdice, 5, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
3435 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("¥ª¡¼¥¯:", "Orcs:"), TERM_YELLOW);
3437 else if (have_flag(flgs, TR_SLAY_ORC))
3439 mindam = calc_expect_dice(mindice, 3, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
3440 maxdam = calc_expect_dice(maxdice, 3, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
3441 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("¥ª¡¼¥¯:", "Orcs:"), TERM_YELLOW);
3443 if (have_flag(flgs, TR_KILL_TROLL))
3445 mindam = calc_expect_dice(mindice, 5, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
3446 maxdam = calc_expect_dice(maxdice, 5, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
3447 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("¥È¥í¥ë:", "Trolls:") , TERM_YELLOW);
3449 else if (have_flag(flgs, TR_SLAY_TROLL))
3451 mindam = calc_expect_dice(mindice, 3, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
3452 maxdam = calc_expect_dice(maxdice, 3, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
3453 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("¥È¥í¥ë:", "Trolls:") , TERM_YELLOW);
3455 if (have_flag(flgs, TR_KILL_GIANT))
3457 mindam = calc_expect_dice(mindice, 5, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
3458 maxdam = calc_expect_dice(maxdice, 5, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
3459 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("µð¿Í:", "Giants:"), TERM_YELLOW);
3461 else if (have_flag(flgs, TR_SLAY_GIANT))
3463 mindam = calc_expect_dice(mindice, 3, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
3464 maxdam = calc_expect_dice(maxdice, 3, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
3465 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("µð¿Í:", "Giants:"), TERM_YELLOW);
3467 if (have_flag(flgs, TR_KILL_DRAGON))
3469 mindam = calc_expect_dice(mindice, 5, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
3470 maxdam = calc_expect_dice(maxdice, 5, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
3471 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("ε:", "Dragons:"), TERM_YELLOW);
3473 else if (have_flag(flgs, TR_SLAY_DRAGON))
3475 mindam = calc_expect_dice(mindice, 3, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
3476 maxdam = calc_expect_dice(maxdice, 3, 1, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
3477 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("ε:", "Dragons:"), TERM_YELLOW);
3479 if (have_flag(flgs, TR_BRAND_ACID))
3481 mindam = calc_expect_dice(mindice, 5, 2, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
3482 maxdam = calc_expect_dice(maxdice, 5, 2, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
3483 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("»À°À:", "Acid:"), TERM_RED);
3485 if (have_flag(flgs, TR_BRAND_ELEC))
3487 mindam = calc_expect_dice(mindice, 5, 2, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
3488 maxdam = calc_expect_dice(maxdice, 5, 2, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
3489 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("ÅÅ°À:", "Elec:"), TERM_RED);
3491 if (have_flag(flgs, TR_BRAND_FIRE))
3493 mindam = calc_expect_dice(mindice, 5, 2, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
3494 maxdam = calc_expect_dice(maxdice, 5, 2, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
3495 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("±ê°À:", "Fire:"), TERM_RED);
3497 if (have_flag(flgs, TR_BRAND_COLD))
3499 mindam = calc_expect_dice(mindice, 5, 2, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
3500 maxdam = calc_expect_dice(maxdice, 5, 2, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
3501 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("Îä°À:", "Cold:"), TERM_RED);
3503 if (have_flag(flgs, TR_BRAND_POIS))
3505 mindam = calc_expect_dice(mindice, 5, 2, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
3506 maxdam = calc_expect_dice(maxdice, 5, 2, force, o_ptr->weight, o_ptr->to_h, p_ptr->to_h[0], dokubari, vorpal_mult, vorpal_div);
3507 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("ÆÇ°À:", "Poison:"), TERM_RED);
3511 static int hit_chance(int to_h, int ac)
3514 int meichuu = p_ptr->skill_thn + (p_ptr->to_h[0] + to_h) * BTH_PLUS_ADJ;
3516 if (meichuu <= 0) return 5;
3518 chance = 100 - ((ac * 75) / meichuu);
3520 if (chance > 95) chance = 95;
3521 if (chance < 5) chance = 5;
3522 if (p_ptr->pseikaku == SEIKAKU_NAMAKE)
3523 chance = (chance*19+9)/20;
3528 * Displays all info about a weapon
3530 * Only accurate for the current weapon, because it includes
3531 * various info about the player's +to_dam and number of blows.
3533 static void list_weapon(object_type *o_ptr, int row, int col)
3535 char o_name[MAX_NLEN];
3538 /* Effective dices */
3539 int eff_dd = o_ptr->dd + p_ptr->to_dd[0];
3540 int eff_ds = o_ptr->ds + p_ptr->to_ds[0];
3542 /* Print the weapon name */
3543 object_desc(o_name, o_ptr, OD_NAME_ONLY);
3544 c_put_str(TERM_YELLOW, o_name, row, col);
3546 /* Print the player's number of blows */
3548 sprintf(tmp_str, "¹¶·â²ó¿ô: %d", p_ptr->num_blow[0]);
3550 sprintf(tmp_str, "Number of Blows: %d", p_ptr->num_blow[0]);
3553 put_str(tmp_str, row+1, col);
3555 /* Print to_hit and to_dam of the weapon */
3557 sprintf(tmp_str, "Ì¿ÃæΨ: 0 50 100 150 200 (Ũ¤ÎAC)");
3559 sprintf(tmp_str, "To Hit: 0 50 100 150 200 (AC)");
3562 put_str(tmp_str, row+2, col);
3564 /* Print the weapons base damage dice */
3566 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));
3568 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));
3571 put_str(tmp_str, row+3, col);
3574 c_put_str(TERM_YELLOW, "²Äǽ¤Ê¥À¥á¡¼¥¸:", row+5, col);
3576 c_put_str(TERM_YELLOW, "Possible Damage:", row+5, col);
3580 /* Damage for one blow (if it hits) */
3582 sprintf(tmp_str, "¹¶·â°ì²ó¤Ë¤Ä¤ %d-%d",
3584 sprintf(tmp_str, "One Strike: %d-%d damage",
3587 eff_dd + o_ptr->to_d + p_ptr->to_d[0],
3588 eff_ds * eff_dd + o_ptr->to_d + p_ptr->to_d[0]);
3589 put_str(tmp_str, row+6, col+1);
3591 /* Damage for the complete attack (if all blows hit) */
3593 sprintf(tmp_str, "£±¥¿¡¼¥ó¤Ë¤Ä¤ %d-%d",
3595 sprintf(tmp_str, "One Attack: %d-%d damage",
3598 p_ptr->num_blow[0] * (eff_dd + o_ptr->to_d + p_ptr->to_d[0]),
3599 p_ptr->num_blow[0] * (eff_ds * eff_dd + o_ptr->to_d + p_ptr->to_d[0]));
3600 put_str(tmp_str, row+7, col+1);
3605 * Hook to specify "weapon"
3607 static bool item_tester_hook_melee_weapon(object_type *o_ptr)
3609 switch (o_ptr->tval)
3619 if (o_ptr->sval != SV_DOKUBARI) return (TRUE);
3628 * Hook to specify "ammo"
3630 static bool item_tester_hook_ammo(object_type *o_ptr)
3632 switch (o_ptr->tval)
3649 * Copies the weapons to compare into the weapon-slot and
3650 * compares the values for both weapons.
3652 static int compare_weapons(int bcost)
3656 object_type *o_ptr[2];
3657 object_type orig_weapon;
3661 int wid = 38, mgn = 2;
3662 bool old_character_xtra = character_xtra;
3665 int cost = 0; /* First time no price */
3667 /* Save the screen */
3670 /* Clear the screen */
3673 /* Store copy of original wielded weapon */
3674 i_ptr = &inventory[INVEN_RARM];
3675 object_copy(&orig_weapon, i_ptr);
3677 /* Only compare melee weapons */
3678 item_tester_no_ryoute = TRUE;
3679 item_tester_hook = item_tester_hook_melee_weapon;
3681 /* Get the first weapon */
3682 q = _("Âè°ì¤ÎÉð´ï¤Ï¡©", "What is your first weapon? ");
3683 s = _("Èæ¤Ù¤ë¤â¤Î¤¬¤¢¤ê¤Þ¤»¤ó¡£", "You have nothing to compare.");
3685 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN)))
3691 /* Get the item (in the pack) */
3692 o_ptr[0] = &inventory[item];
3698 /* Clear the screen */
3701 /* Only compare melee weapons */
3702 item_tester_no_ryoute = TRUE;
3703 item_tester_hook = item_tester_hook_melee_weapon;
3705 /* Hack -- prevent "icky" message */
3706 character_xtra = TRUE;
3708 /* Diaplay selected weapon's infomation */
3709 for (i = 0; i < n; i++)
3711 int col = (wid * i + mgn);
3713 /* Copy i-th weapon into the weapon slot (if it's not already there) */
3714 if (o_ptr[i] != i_ptr) object_copy(i_ptr, o_ptr[i]);
3716 /* Get the new values */
3719 /* List the new values */
3720 list_weapon(o_ptr[i], row, col);
3721 compare_weapon_aux(o_ptr[i], col, row + 8);
3723 /* Copy back the original weapon into the weapon slot */
3724 object_copy(i_ptr, &orig_weapon);
3727 /* Reset the values for the old weapon */
3730 character_xtra = old_character_xtra;
3733 put_str(format("[ Èæ³ÓÂоÝ: 's'¤ÇÊѹ¹ ($%d) ]", cost), 1, (wid + mgn));
3734 put_str("(°ìÈֹ⤤¥À¥á¡¼¥¸¤¬Å¬ÍѤµ¤ì¤Þ¤¹¡£Ê£¿ô¤ÎÇÜÂǸú²Ì¤Ï¤·»»¤µ¤ì¤Þ¤»¤ó¡£)", row + 4, 0);
3735 prt("¸½ºß¤Îµ»Î̤«¤éȽÃǤ¹¤ë¤È¡¢¤¢¤Ê¤¿¤ÎÉð´ï¤Ï°Ê²¼¤Î¤è¤¦¤Ê°ÒÎϤòȯ´ø¤·¤Þ¤¹:", 0, 0);
3737 put_str(format("[ 's' Select secondary weapon($%d) ]", cost), row + 1, (wid * i + mgn));
3738 put_str("(Only highest damage applies per monster. Special damage not cumulative.)", row + 4, 0);
3739 prt("Based on your current abilities, here is what your weapons will do", 0, 0);
3747 if (total + cost > p_ptr->au)
3749 msg_print(_("¤ª¶â¤¬Â¤ê¤Þ¤»¤ó¡ª", "You don't have enough money!"));
3754 q = _("ÂèÆó¤ÎÉð´ï¤Ï¡©", "What is your second weapon? ");
3755 s = _("Èæ¤Ù¤ë¤â¤Î¤¬¤¢¤ê¤Þ¤»¤ó¡£", "You have nothing to compare.");
3757 /* Get the second weapon */
3758 if (!get_item(&item2, q, s, (USE_EQUIP | USE_INVEN))) continue;
3763 /* Get the item (in the pack) */
3764 o_ptr[1] = &inventory[item2];
3773 /* Restore the screen */
3784 * AC¤«¤é²óÈòΨ¡¢¥À¥á¡¼¥¸¸º¾¯Î¨¤ò·×»»¤·É½¼¨¤¹¤ë
3785 * Calculate and display the dodge-rate and the protection-rate
3788 static bool eval_ac(int iAC)
3792 "¥À¥á¡¼¥¸·Ú¸ºÎ¨¤È¤Ï¡¢Å¨¤Î¹¶·â¤¬Åö¤¿¤Ã¤¿»þ¤½¤Î¥À¥á¡¼¥¸¤ò\n"
3793 "²¿¥Ñ¡¼¥»¥ó¥È·Ú¸º¤¹¤ë¤«¤ò¼¨¤·¤Þ¤¹¡£\n"
3794 "¥À¥á¡¼¥¸·Ú¸º¤ÏÄ̾ï¤ÎľÀܹ¶·â(¼ïÎब¡Ö¹¶·â¤¹¤ë¡×¤È¡ÖÊ´ºÕ¤¹¤ë¡×¤Îʪ)\n"
3795 "¤ËÂФ·¤Æ¤Î¤ß¸ú²Ì¤¬¤¢¤ê¤Þ¤¹¡£\n \n"
3796 "Ũ¤Î¥ì¥Ù¥ë¤È¤Ï¡¢¤½¤ÎŨ¤¬Ä̾ﲿ³¬¤Ë¸½¤ì¤ë¤«¤ò¼¨¤·¤Þ¤¹¡£\n \n"
3797 "²óÈòΨ¤ÏŨ¤ÎľÀܹ¶·â¤ò²¿¥Ñ¡¼¥»¥ó¥È¤Î³ÎΨ¤ÇÈò¤±¤ë¤«¤ò¼¨¤·¡¢\n"
3798 "Ũ¤Î¥ì¥Ù¥ë¤È¤¢¤Ê¤¿¤ÎAC¤Ë¤è¤Ã¤Æ·èÄꤵ¤ì¤Þ¤¹¡£\n \n"
3799 "¥À¥á¡¼¥¸´üÂÔÃͤȤϡ¢Å¨¤Î£±£°£°¥Ý¥¤¥ó¥È¤ÎÄ̾ﹶ·â¤ËÂФ·¡¢\n"
3800 "²óÈòΨ¤È¥À¥á¡¼¥¸·Ú¸ºÎ¨¤ò¹Íθ¤·¤¿¥À¥á¡¼¥¸¤Î´üÂÔÃͤò¼¨¤·¤Þ¤¹¡£\n";
3803 "'Protection Rate' means how much damage is reduced by your armor.\n"
3804 "Note that the Protection rate is effective only against normal "
3805 "'attack' and 'shatter' type melee attacks, "
3806 "and has no effect against any other types such as 'poison'.\n \n"
3807 "'Dodge Rate' indicates the success rate on dodging the "
3808 "monster's melee attacks. "
3809 "It is depend on the level of the monster and your AC.\n \n"
3810 "'Average Damage' indicates the expected amount of damage "
3811 "when you are attacked by normal melee attacks with power=100.";
3817 char buf[80*20], *t;
3819 /* AC lower than zero has no effect */
3820 if (iAC < 0) iAC = 0;
3822 /* ¥À¥á¡¼¥¸·Ú¸ºÎ¨¤ò·×»» */
3823 protection = 100 * MIN(iAC, 150) / 250;
3829 put_str(format("¤¢¤Ê¤¿¤Î¸½ºß¤ÎAC: %3d", iAC), row++, 0);
3830 put_str(format("¥À¥á¡¼¥¸·Ú¸ºÎ¨ : %3d%%", protection), row++, 0);
3833 put_str("Ũ¤Î¥ì¥Ù¥ë :", row + 0, 0);
3834 put_str("²óÈòΨ :", row + 1, 0);
3835 put_str("¥À¥á¡¼¥¸´üÂÔÃÍ :", row + 2, 0);
3837 put_str(format("Your current AC : %3d", iAC), row++, 0);
3838 put_str(format("Protection rate : %3d%%", protection), row++, 0);
3841 put_str("Level of Monster:", row + 0, 0);
3842 put_str("Dodge Rate :", row + 1, 0);
3843 put_str("Average Damage :", row + 2, 0);
3846 for (col = 17 + 1, lvl = 0; lvl <= 100; lvl += 10, col += 5)
3848 int quality = 60 + lvl * 3; /* attack quality with power 60 */
3849 int dodge; /* ²óÈòΨ(%) */
3850 int average; /* ¥À¥á¡¼¥¸´üÂÔÃÍ */
3852 put_str(format("%3d", lvl), row + 0, col);
3855 dodge = 5 + (MIN(100, 100 * (iAC * 3 / 4) / quality) * 9 + 5) / 10;
3856 put_str(format("%3d%%", dodge), row + 1, col);
3858 /* 100ÅÀ¤Î¹¶·â¤ËÂФ·¤Æ¤Î¥À¥á¡¼¥¸´üÂÔÃͤò·×»» */
3859 average = (100 - dodge) * (100 - protection) / 100;
3860 put_str(format("%3d", average), row + 2, col);
3864 roff_to_buf(memo, 70, buf, sizeof(buf));
3865 for (t = buf; t[0]; t += strlen(t) + 1)
3866 put_str(t, (row++) + 4, 4);
3869 prt("¸½ºß¤Î¤¢¤Ê¤¿¤ÎÁõÈ÷¤«¤é¤¹¤ë¤È¡¢¤¢¤Ê¤¿¤ÎËɸæÎϤÏ"
3870 "¤³¤ì¤¯¤é¤¤¤Ç¤¹:", 0, 0);
3872 prt("Defense abilities from your current Armor Class are evaluated below.", 0, 0);
3885 * Hook to specify "broken weapon"
3887 static bool item_tester_hook_broken_weapon(object_type *o_ptr)
3889 if (o_ptr->tval != TV_SWORD) return FALSE;
3891 switch (o_ptr->sval)
3893 case SV_BROKEN_DAGGER:
3894 case SV_BROKEN_SWORD:
3901 static void give_one_ability_of_object(object_type *to_ptr, object_type *from_ptr)
3904 int cand[TR_FLAG_MAX];
3905 u32b to_flgs[TR_FLAG_SIZE];
3906 u32b from_flgs[TR_FLAG_SIZE];
3908 object_flags(to_ptr, to_flgs);
3909 object_flags(from_ptr, from_flgs);
3911 for (i = 0; i < TR_FLAG_MAX; i++)
3915 case TR_IGNORE_ACID:
3916 case TR_IGNORE_ELEC:
3917 case TR_IGNORE_FIRE:
3918 case TR_IGNORE_COLD:
3927 case TR_FIXED_FLAVOR:
3930 if (have_flag(from_flgs, i) && !have_flag(to_flgs, i))
3932 if (!(is_pval_flag(i) && (from_ptr->pval < 1))) cand[n++] = i;
3940 int tr_idx = cand[randint0(n)];
3941 add_flag(to_ptr->art_flags, tr_idx);
3942 if (is_pval_flag(tr_idx)) to_ptr->pval = MAX(to_ptr->pval, 1);
3943 bmax = MIN(3, MAX(1, 40 / (to_ptr->dd * to_ptr->ds)));
3944 if (tr_idx == TR_BLOWS) to_ptr->pval = MIN(to_ptr->pval, bmax);
3945 if (tr_idx == TR_SPEED) to_ptr->pval = MIN(to_ptr->pval, 4);
3952 * Repair broken weapon
3954 static int repair_broken_weapon_aux(int bcost)
3958 object_type *o_ptr, *mo_ptr; /* broken weapon and material weapon */
3960 int i, k_idx, dd_bonus, ds_bonus;
3961 char basenm[MAX_NLEN];
3962 cptr q, s; /* For get_item prompt */
3969 prt(_("½¤Éü¤Ë¤ÏºàÎÁ¤È¤Ê¤ë¤â¤¦1¤Ä¤ÎÉð´ï¤¬É¬ÍפǤ¹¡£", "Hand one material weapon to repair a broken weapon."), row, 2);
3970 prt(_("ºàÎÁ¤Ë»ÈÍѤ·¤¿Éð´ï¤Ï¤Ê¤¯¤Ê¤ê¤Þ¤¹¡ª", "The material weapon will disappear after repairing!!"), row+1, 2);
3973 q = _("¤É¤ÎÀޤ줿Éð´ï¤ò½¤Éü¤·¤Þ¤¹¤«¡©", "Repair which broken weapon? ");
3974 s = _("½¤Éü¤Ç¤¤ëÀޤ줿Éð´ï¤¬¤¢¤ê¤Þ¤»¤ó¡£", "You have no broken weapon to repair.");
3976 /* Only forge broken weapons */
3977 item_tester_hook = item_tester_hook_broken_weapon;
3979 if (!get_item(&item, q, s, (USE_INVEN | USE_EQUIP))) return (0);
3981 /* Get the item (in the pack) */
3982 o_ptr = &inventory[item];
3984 /* It is worthless */
3985 if (!object_is_ego(o_ptr) && !object_is_artifact(o_ptr))
3987 msg_format(_("¤½¤ì¤Ïľ¤·¤Æ¤â¤·¤ç¤¦¤¬¤Ê¤¤¤¼¡£", "It is worthless to repair."));
3991 /* They are too many */
3992 if (o_ptr->number > 1)
3994 msg_format(_("°ìÅÙ¤ËÊ£¿ô¤ò½¤Éü¤¹¤ë¤³¤È¤Ï¤Ç¤¤Þ¤»¤ó¡ª", "They are too many to repair at once!"));
3998 /* Display item name */
3999 object_desc(basenm, o_ptr, OD_NAME_ONLY);
4000 prt(format(_("½¤Éü¤¹¤ëÉð´ï¡¡¡§ %s", "Repairing: %s"), basenm), row+3, 2);
4003 q = _("ºàÎÁ¤È¤Ê¤ëÉð´ï¤Ï¡©", "Which weapon for material? ");
4004 s = _("ºàÎÁ¤È¤Ê¤ëÉð´ï¤¬¤¢¤ê¤Þ¤»¤ó¡£", "You have no material to repair.");
4006 /* Only forge broken weapons */
4007 item_tester_hook = item_tester_hook_melee_weapon;
4009 if (!get_item(&mater, q, s, (USE_INVEN | USE_EQUIP))) return (0);
4012 msg_print(_("¥¯¥é¥¤¥ó¤ÎÄÛ¤¸¤ã¤Ê¤¤¡ª", "This is not a klein bottle!"));
4016 /* Get the item (in the pack) */
4017 mo_ptr = &inventory[mater];
4019 /* Display item name */
4020 object_desc(basenm, mo_ptr, OD_NAME_ONLY);
4021 prt(format(_("ºàÎÁ¤È¤¹¤ëÉð´ï¡§ %s", "Material : %s"), basenm), row+4, 2);
4023 /* Get the value of one of the items (except curses) */
4024 cost = bcost + object_value_real(o_ptr) * 2;
4027 if (!get_check(format("¡ð%d¤«¤«¤ê¤Þ¤¹¤¬¤è¤í¤·¤¤¤Ç¤¹¤«¡© ", cost))) return (0);
4029 if (!get_check(format("Costs %d gold, okay? ", cost))) return (0);
4032 /* Check if the player has enough money */
4033 if (p_ptr->au < cost)
4035 object_desc(basenm, o_ptr, OD_NAME_ONLY);
4036 msg_format(_("%s¤ò½¤Éü¤¹¤ë¤À¤±¤Î¥´¡¼¥ë¥É¤¬¤¢¤ê¤Þ¤»¤ó¡ª",
4037 "You do not have the gold to repair %s!"), basenm);
4042 if (o_ptr->sval == SV_BROKEN_DAGGER)
4046 /* Suppress compiler warning */
4049 for (i = 1; i < max_k_idx; i++)
4051 object_kind *k_ptr = &k_info[i];
4053 if (k_ptr->tval != TV_SWORD) continue;
4054 if ((k_ptr->sval == SV_BROKEN_DAGGER) ||
4055 (k_ptr->sval == SV_BROKEN_SWORD) ||
4056 (k_ptr->sval == SV_DOKUBARI)) continue;
4057 if (k_ptr->weight > 99) continue;
4066 else /* TV_BROKEN_SWORD */
4068 /* Repair to a sword or sometimes material's type weapon */
4069 int tval = (one_in_(5) ? mo_ptr->tval : TV_SWORD);
4073 object_kind *ck_ptr;
4075 k_idx = lookup_kind(tval, SV_ANY);
4076 ck_ptr = &k_info[k_idx];
4078 if (tval == TV_SWORD)
4080 if ((ck_ptr->sval == SV_BROKEN_DAGGER) ||
4081 (ck_ptr->sval == SV_BROKEN_SWORD) ||
4082 (ck_ptr->sval == SV_DIAMOND_EDGE) ||
4083 (ck_ptr->sval == SV_DOKUBARI)) continue;
4085 if (tval == TV_POLEARM)
4087 if ((ck_ptr->sval == SV_DEATH_SCYTHE) ||
4088 (ck_ptr->sval == SV_TSURIZAO)) continue;
4090 if (tval == TV_HAFTED)
4092 if ((ck_ptr->sval == SV_GROND) ||
4093 (ck_ptr->sval == SV_WIZSTAFF) ||
4094 (ck_ptr->sval == SV_NAMAKE_HAMMER)) continue;
4101 /* Calculate dice bonuses */
4102 dd_bonus = o_ptr->dd - k_info[o_ptr->k_idx].dd;
4103 ds_bonus = o_ptr->ds - k_info[o_ptr->k_idx].ds;
4104 dd_bonus += mo_ptr->dd - k_info[mo_ptr->k_idx].dd;
4105 ds_bonus += mo_ptr->ds - k_info[mo_ptr->k_idx].ds;
4107 /* Change base object */
4108 k_ptr = &k_info[k_idx];
4109 o_ptr->k_idx = k_idx;
4110 o_ptr->weight = k_ptr->weight;
4111 o_ptr->tval = k_ptr->tval;
4112 o_ptr->sval = k_ptr->sval;
4113 o_ptr->dd = k_ptr->dd;
4114 o_ptr->ds = k_ptr->ds;
4116 /* Copy base object's ability */
4117 for (i = 0; i < TR_FLAG_SIZE; i++) o_ptr->art_flags[i] |= k_ptr->flags[i];
4118 if (k_ptr->pval) o_ptr->pval = MAX(o_ptr->pval, randint1(k_ptr->pval));
4119 if (have_flag(k_ptr->flags, TR_ACTIVATE)) o_ptr->xtra2 = k_ptr->act_idx;
4125 for (i = 0; i < dd_bonus; i++)
4127 if (one_in_(o_ptr->dd + i)) o_ptr->dd++;
4133 for (i = 0; i < ds_bonus; i++)
4135 if (one_in_(o_ptr->ds + i)) o_ptr->ds++;
4140 if (have_flag(k_ptr->flags, TR_BLOWS))
4142 int bmax = MIN(3, MAX(1, 40 / (o_ptr->dd * o_ptr->ds)));
4143 o_ptr->pval = MIN(o_ptr->pval, bmax);
4146 /* Add one random ability from material weapon */
4147 give_one_ability_of_object(o_ptr, mo_ptr);
4149 /* Add to-dam, to-hit and to-ac from material weapon */
4150 o_ptr->to_d += MAX(0, (mo_ptr->to_d / 3));
4151 o_ptr->to_h += MAX(0, (mo_ptr->to_h / 3));
4152 o_ptr->to_a += MAX(0, (mo_ptr->to_a));
4154 if ((o_ptr->name1 == ART_NARSIL) ||
4155 (object_is_random_artifact(o_ptr) && one_in_(1)) ||
4156 (object_is_ego(o_ptr) && one_in_(7)))
4159 if (object_is_ego(o_ptr))
4161 add_flag(o_ptr->art_flags, TR_IGNORE_FIRE);
4162 add_flag(o_ptr->art_flags, TR_IGNORE_ACID);
4165 /* Add one random ability from material weapon */
4166 give_one_ability_of_object(o_ptr, mo_ptr);
4168 /* Add one random activation */
4169 if (!activation_index(o_ptr)) one_activation(o_ptr);
4172 if (o_ptr->name1 == ART_NARSIL)
4174 one_high_resistance(o_ptr);
4178 msg_print(_("¤³¤ì¤Ï¤«¤Ê¤ê¤Î¶Èʪ¤À¤Ã¤¿¤è¤¦¤À¡£", "This blade seems to be exceptionally."));
4181 object_desc(basenm, o_ptr, OD_NAME_ONLY);
4183 msg_format("¡ð%d¤Ç%s¤Ë½¤Éü¤·¤Þ¤·¤¿¡£", cost, basenm);
4185 msg_format("Repaired into %s for %d gold.", basenm, cost);
4189 /* Remove BROKEN flag */
4190 o_ptr->ident &= ~(IDENT_BROKEN);
4192 /* Add repaired flag */
4193 o_ptr->discount = 99;
4195 /* Decrease material object */
4196 inven_item_increase(mater, -1);
4197 inven_item_optimize(mater);
4200 p_ptr->update |= PU_BONUS;
4203 /* Something happened */
4207 static int repair_broken_weapon(int bcost)
4212 cost = repair_broken_weapon_aux(bcost);
4221 static bool enchant_item(int cost, int to_hit, int to_dam, int to_ac)
4227 int maxenchant = (p_ptr->lev / 5);
4228 char tmp_str[MAX_NLEN];
4232 prt(format("¸½ºß¤Î¤¢¤Ê¤¿¤Îµ»Î̤À¤È¡¢+%d ¤Þ¤Ç²þÎɤǤ¤Þ¤¹¡£", maxenchant), 5, 0);
4233 prt(format(" ²þÎɤÎÎÁ¶â¤Ï°ì¸Ä¤Ë¤Ä¤¡ð%d ¤Ç¤¹¡£", cost), 7, 0);
4235 prt(format(" Based on your skill, we can improve up to +%d.", maxenchant), 5, 0);
4236 prt(format(" The price for the service is %d gold per item.", cost), 7, 0);
4239 item_tester_no_ryoute = TRUE;
4243 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò²þÎɤ·¤Þ¤¹¤«¡©";
4244 s = "²þÎɤǤ¤ë¤â¤Î¤¬¤¢¤ê¤Þ¤»¤ó¡£";
4246 q = "Improve which item? ";
4247 s = "You have nothing to improve.";
4250 if (!get_item(&item, q, s, (USE_INVEN | USE_EQUIP))) return (FALSE);
4252 /* Get the item (in the pack) */
4253 o_ptr = &inventory[item];
4255 /* Check if the player has enough money */
4256 if (p_ptr->au < (cost * o_ptr->number))
4258 object_desc(tmp_str, o_ptr, OD_NAME_ONLY);
4260 msg_format("%s¤ò²þÎɤ¹¤ë¤À¤±¤Î¥´¡¼¥ë¥É¤¬¤¢¤ê¤Þ¤»¤ó¡ª", tmp_str);
4262 msg_format("You do not have the gold to improve %s!", tmp_str);
4268 /* Enchant to hit */
4269 for (i = 0; i < to_hit; i++)
4271 if (o_ptr->to_h < maxenchant)
4273 if (enchant(o_ptr, 1, (ENCH_TOHIT | ENCH_FORCE)))
4281 /* Enchant to damage */
4282 for (i = 0; i < to_dam; i++)
4284 if (o_ptr->to_d < maxenchant)
4286 if (enchant(o_ptr, 1, (ENCH_TODAM | ENCH_FORCE)))
4295 for (i = 0; i < to_ac; i++)
4297 if (o_ptr->to_a < maxenchant)
4299 if (enchant(o_ptr, 1, (ENCH_TOAC | ENCH_FORCE)))
4311 if (flush_failure) flush();
4315 msg_print("²þÎɤ˼ºÇÔ¤·¤¿¡£");
4317 msg_print("The improvement failed.");
4324 object_desc(tmp_str, o_ptr, OD_NAME_AND_ENCHANT);
4326 msg_format("¡ð%d¤Ç%s¤Ë²þÎɤ·¤Þ¤·¤¿¡£", cost * o_ptr->number, tmp_str);
4328 msg_format("Improved into %s for %d gold.", tmp_str, cost * o_ptr->number);
4331 /* Charge the money */
4332 p_ptr->au -= (cost * o_ptr->number);
4334 if (item >= INVEN_RARM) calc_android_exp();
4336 /* Something happened */
4343 * Recharge rods, wands and staves
4345 * The player can select the number of charges to add
4346 * (up to a limit), and the recharge never fails.
4348 * The cost for rods depends on the level of the rod. The prices
4349 * for recharging wands and staves are dependent on the cost of
4352 static void building_recharge(void)
4361 char tmp_str[MAX_NLEN];
4365 /* Display some info */
4368 prt(" ºÆ½¼Å¶¤ÎÈñÍѤϥ¢¥¤¥Æ¥à¤Î¼ïÎà¤Ë¤è¤ê¤Þ¤¹¡£", 6, 0);
4370 prt(" The prices of recharge depend on the type.", 6, 0);
4374 /* Only accept legal items */
4375 item_tester_hook = item_tester_hook_recharge;
4379 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ËËâÎϤò½¼Å¶¤·¤Þ¤¹¤«? ";
4380 s = "ËâÎϤò½¼Å¶¤¹¤Ù¤¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡£";
4382 q = "Recharge which item? ";
4383 s = "You have nothing to recharge.";
4386 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
4388 /* Get the item (in the pack) */
4391 o_ptr = &inventory[item];
4394 /* Get the item (on the floor) */
4397 o_ptr = &o_list[0 - item];
4400 k_ptr = &k_info[o_ptr->k_idx];
4403 * We don't want to give the player free info about
4404 * the level of the item or the number of charges.
4406 /* The item must be "known" */
4407 if (!object_is_known(o_ptr))
4410 msg_format("½¼Å¶¤¹¤ëÁ°¤Ë´ÕÄꤵ¤ì¤Æ¤¤¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡ª");
4412 msg_format("The item must be identified first!");
4417 if ((p_ptr->au >= 50) &&
4419 get_check("¡ð50¤Ç´ÕÄꤷ¤Þ¤¹¤«¡© "))
4421 get_check("Identify for 50 gold? "))
4429 identify_item(o_ptr);
4432 object_desc(tmp_str, o_ptr, 0);
4435 msg_format("%s ¤Ç¤¹¡£", tmp_str);
4437 msg_format("You have: %s.", tmp_str);
4440 /* Auto-inscription */
4441 autopick_alter_item(item, FALSE);
4443 /* Update the gold display */
4444 building_prt_gold();
4452 /* Extract the object "level" */
4453 lev = k_info[o_ptr->k_idx].level;
4455 /* Price for a rod */
4456 if (o_ptr->tval == TV_ROD)
4458 if (o_ptr->timeout > 0)
4460 /* Fully recharge */
4461 price = (lev * 50 * o_ptr->timeout) / k_ptr->pval;
4465 /* No recharge necessary */
4468 msg_format("¤½¤ì¤ÏºÆ½¼Å¶¤¹¤ëɬÍפϤ¢¤ê¤Þ¤»¤ó¡£");
4470 msg_format("That doesn't need to be recharged.");
4476 else if (o_ptr->tval == TV_STAFF)
4478 /* Price per charge ( = double the price paid by shopkeepers for the charge) */
4479 price = (k_info[o_ptr->k_idx].cost / 10) * o_ptr->number;
4481 /* Pay at least 10 gold per charge */
4482 price = MAX(10, price);
4486 /* Price per charge ( = double the price paid by shopkeepers for the charge) */
4487 price = (k_info[o_ptr->k_idx].cost / 10);
4489 /* Pay at least 10 gold per charge */
4490 price = MAX(10, price);
4493 /* Limit the number of charges for wands and staffs */
4494 if (o_ptr->tval == TV_WAND
4495 && (o_ptr->pval / o_ptr->number >= k_ptr->pval))
4497 if (o_ptr->number > 1)
4500 msg_print("¤³¤ÎËâË¡ËÀ¤Ï¤â¤¦½¼Ê¬¤Ë½¼Å¶¤µ¤ì¤Æ¤¤¤Þ¤¹¡£");
4502 msg_print("These wands are already fully charged.");
4508 msg_print("¤³¤ÎËâË¡ËÀ¤Ï¤â¤¦½¼Ê¬¤Ë½¼Å¶¤µ¤ì¤Æ¤¤¤Þ¤¹¡£");
4510 msg_print("This wand is already fully charged.");
4515 else if (o_ptr->tval == TV_STAFF && o_ptr->pval >= k_ptr->pval)
4517 if (o_ptr->number > 1)
4520 msg_print("¤³¤Î¾ó¤Ï¤â¤¦½¼Ê¬¤Ë½¼Å¶¤µ¤ì¤Æ¤¤¤Þ¤¹¡£");
4522 msg_print("These staffs are already fully charged.");
4528 msg_print("¤³¤Î¾ó¤Ï¤â¤¦½¼Ê¬¤Ë½¼Å¶¤µ¤ì¤Æ¤¤¤Þ¤¹¡£");
4530 msg_print("This staff is already fully charged.");
4536 /* Check if the player has enough money */
4537 if (p_ptr->au < price)
4539 object_desc(tmp_str, o_ptr, OD_NAME_ONLY);
4541 msg_format("%s¤òºÆ½¼Å¶¤¹¤ë¤Ë¤Ï¡ð%d ɬÍפǤ¹¡ª", tmp_str,price );
4543 msg_format("You need %d gold to recharge %s!", price, tmp_str);
4549 if (o_ptr->tval == TV_ROD)
4552 if (get_check(format("¤½¤Î¥í¥Ã¥É¤ò¡ð%d ¤ÇºÆ½¼Å¶¤·¤Þ¤¹¤«¡©",
4555 if (get_check(format("Recharge the %s for %d gold? ",
4556 ((o_ptr->number > 1) ? "rods" : "rod"), price)))
4560 /* Recharge fully */
4570 if (o_ptr->tval == TV_STAFF)
4571 max_charges = k_ptr->pval - o_ptr->pval;
4573 max_charges = o_ptr->number * k_ptr->pval - o_ptr->pval;
4575 /* Get the quantity for staves and wands */
4577 charges = get_quantity(format("°ì²óʬ¡ð%d ¤Ç²¿²óʬ½¼Å¶¤·¤Þ¤¹¤«¡©",
4579 charges = get_quantity(format("Add how many charges for %d gold? ",
4582 price), MIN(p_ptr->au / price, max_charges));
4585 if (charges < 1) return;
4587 /* Get the new price */
4591 o_ptr->pval += charges;
4593 /* We no longer think the item is empty */
4594 o_ptr->ident &= ~(IDENT_EMPTY);
4598 object_desc(tmp_str, o_ptr, 0);
4600 msg_format("%s¤ò¡ð%d ¤ÇºÆ½¼Å¶¤·¤Þ¤·¤¿¡£", tmp_str, price);
4602 msg_format("%^s %s recharged for %d gold.", tmp_str, ((o_ptr->number > 1) ? "were" : "was"), price);
4605 /* Combine / Reorder the pack (later) */
4606 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
4609 p_ptr->window |= (PW_INVEN);
4620 * Recharge rods, wands and staves
4622 * The player can select the number of charges to add
4623 * (up to a limit), and the recharge never fails.
4625 * The cost for rods depends on the level of the rod. The prices
4626 * for recharging wands and staves are dependent on the cost of
4629 static void building_recharge_all(void)
4639 /* Display some info */
4643 prt(" ºÆ½¼Å¶¤ÎÈñÍѤϥ¢¥¤¥Æ¥à¤Î¼ïÎà¤Ë¤è¤ê¤Þ¤¹¡£", 6, 0);
4645 prt(" The prices of recharge depend on the type.", 6, 0);
4648 /* Calculate cost */
4649 for ( i = 0; i < INVEN_PACK; i++)
4651 o_ptr = &inventory[i];
4653 /* skip non magic device */
4654 if (o_ptr->tval < TV_STAFF || o_ptr->tval > TV_ROD) continue;
4656 /* need identified */
4657 if (!object_is_known(o_ptr)) total_cost += 50;
4659 /* Extract the object "level" */
4660 lev = k_info[o_ptr->k_idx].level;
4662 k_ptr = &k_info[o_ptr->k_idx];
4664 switch (o_ptr->tval)
4667 price = (lev * 50 * o_ptr->timeout) / k_ptr->pval;
4671 /* Price per charge ( = double the price paid by shopkeepers for the charge) */
4672 price = (k_info[o_ptr->k_idx].cost / 10) * o_ptr->number;
4674 /* Pay at least 10 gold per charge */
4675 price = MAX(10, price);
4678 price = (k_ptr->pval - o_ptr->pval) * price;
4682 /* Price per charge ( = double the price paid by shopkeepers for the charge) */
4683 price = (k_info[o_ptr->k_idx].cost / 10);
4685 /* Pay at least 10 gold per charge */
4686 price = MAX(10, price);
4689 price = (o_ptr->number * k_ptr->pval - o_ptr->pval) * price;
4693 /* if price <= 0 then item have enough charge */
4694 if (price > 0) total_cost += price;
4700 msg_print("½¼Å¶¤¹¤ëɬÍפϤ¢¤ê¤Þ¤»¤ó¡£");
4702 msg_print("No need to recharge.");
4709 /* Check if the player has enough money */
4710 if (p_ptr->au < total_cost)
4713 msg_format("¤¹¤Ù¤Æ¤Î¥¢¥¤¥Æ¥à¤òºÆ½¼Å¶¤¹¤ë¤Ë¤Ï¡ð%d ɬÍפǤ¹¡ª", total_cost );
4715 msg_format("You need %d gold to recharge all items!",total_cost);
4723 if (!get_check(format("¤¹¤Ù¤Æ¤Î¥¢¥¤¥Æ¥à¤ò ¡ð%d ¤ÇºÆ½¼Å¶¤·¤Þ¤¹¤«¡©", total_cost))) return;
4725 if (!get_check(format("Recharge all items for %d gold? ", total_cost))) return;
4728 for (i = 0; i < INVEN_PACK; i++)
4730 o_ptr = &inventory[i];
4731 k_ptr = &k_info[o_ptr->k_idx];
4733 /* skip non magic device */
4734 if (o_ptr->tval < TV_STAFF || o_ptr->tval > TV_ROD) continue;
4737 if (!object_is_known(o_ptr))
4739 identify_item(o_ptr);
4741 /* Auto-inscription */
4742 autopick_alter_item(i, FALSE);
4746 switch (o_ptr->tval)
4752 if (o_ptr->pval < k_ptr->pval) o_ptr->pval = k_ptr->pval;
4753 /* We no longer think the item is empty */
4754 o_ptr->ident &= ~(IDENT_EMPTY);
4757 if (o_ptr->pval < o_ptr->number * k_ptr->pval)
4758 o_ptr->pval = o_ptr->number * k_ptr->pval;
4759 /* We no longer think the item is empty */
4760 o_ptr->ident &= ~(IDENT_EMPTY);
4767 msg_format("¡ð%d ¤ÇºÆ½¼Å¶¤·¤Þ¤·¤¿¡£", total_cost);
4769 msg_format("You pay %d gold.", total_cost);
4774 /* Combine / Reorder the pack (later) */
4775 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
4778 p_ptr->window |= (PW_INVEN);
4781 p_ptr->au -= total_cost;
4788 bool tele_town(void)
4796 msg_print("¤³¤ÎËâË¡¤ÏÃϾå¤Ç¤·¤«»È¤¨¤Ê¤¤¡ª");
4798 msg_print("This spell can only be used on the surface!");
4803 if (p_ptr->inside_arena || p_ptr->inside_battle)
4806 msg_print("¤³¤ÎËâË¡¤Ï³°¤Ç¤·¤«»È¤¨¤Ê¤¤¡ª");
4808 msg_print("This spell can only be used outside!");
4816 for (i=1;i<max_towns;i++)
4820 if ((i == NO_TOWN) || (i == SECRET_TOWN) || (i == p_ptr->town_num) || !(p_ptr->visit & (1L << (i-1)))) continue;
4822 sprintf(buf,"%c) %-20s", I2A(i-1), town[i].name);
4830 msg_print("¤Þ¤À¹Ô¤±¤ë¤È¤³¤í¤¬¤Ê¤¤¡£");
4832 msg_print("You have not yet visited any town.");
4841 prt("¤É¤³¤Ë¹Ô¤¤Þ¤¹¤«:", 0, 0);
4843 prt("Which town you go: ", 0, 0);
4854 else if ((i < 'a') || (i > ('a'+max_towns-2))) continue;
4855 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;
4859 for (y = 0; y < max_wild_y; y++)
4861 for (x = 0; x < max_wild_x; x++)
4863 if(wilderness[y][x].town == (i-'a'+1))
4865 p_ptr->wilderness_y = y;
4866 p_ptr->wilderness_x = x;
4871 p_ptr->leaving = TRUE;
4873 p_ptr->teleport_town = TRUE;
4883 static bool research_mon(void)
4891 bool recall = FALSE;
4897 /* XTRA HACK WHATSEARCH */
4903 /* XTRA HACK REMEMBER_IDX */
4904 static int old_sym = '\0';
4905 static int old_i = 0;
4908 /* Save the screen */
4911 /* Get a character, or abort */
4913 if (!get_com("¥â¥ó¥¹¥¿¡¼¤Îʸ»ú¤òÆþÎϤ·¤Æ²¼¤µ¤¤(µ¹æ or ^AÁ´,^U¥æ,^NÈó¥æ,^M̾Á°):", &sym, FALSE))
4915 if (!get_com("Enter character to be identified(^A:All,^U:Uniqs,^N:Non uniqs,^M:Name): ", &sym, FALSE))
4925 /* Find that character info, and describe it */
4926 for (i = 0; ident_info[i]; ++i)
4928 if (sym == ident_info[i][0]) break;
4931 /* XTRA HACK WHATSEARCH */
4932 if (sym == KTRL('A'))
4936 strcpy(buf, "Á´¥â¥ó¥¹¥¿¡¼¤Î¥ê¥¹¥È");
4938 strcpy(buf, "Full monster list.");
4941 else if (sym == KTRL('U'))
4945 strcpy(buf, "¥æ¥Ë¡¼¥¯¡¦¥â¥ó¥¹¥¿¡¼¤Î¥ê¥¹¥È");
4947 strcpy(buf, "Unique monster list.");
4950 else if (sym == KTRL('N'))
4954 strcpy(buf, "¥æ¥Ë¡¼¥¯³°¥â¥ó¥¹¥¿¡¼¤Î¥ê¥¹¥È");
4956 strcpy(buf, "Non-unique monster list.");
4959 else if (sym == KTRL('M'))
4963 if (!get_string("̾Á°(±Ñ¸ì¤Î¾ì¹ç¾®Ê¸»ú¤Ç²Ä)",temp, 70))
4965 if (!get_string("Enter name:",temp, 70))
4976 sprintf(buf, "̾Á°:%s¤Ë¥Þ¥Ã¥Á",temp);
4978 sprintf(buf, "Monsters with a name \"%s\"",temp);
4981 else if (ident_info[i])
4983 sprintf(buf, "%c - %s.", sym, ident_info[i] + 2);
4988 sprintf(buf, "%c - %s", sym, "̵¸ú¤Êʸ»ú");
4990 sprintf(buf, "%c - %s.", sym, "Unknown Symbol");
4995 /* Display the result */
4999 /* Allocate the "who" array */
5000 C_MAKE(who, max_r_idx, u16b);
5002 /* Collect matching monsters */
5003 for (n = 0, i = 1; i < max_r_idx; i++)
5005 monster_race *r_ptr = &r_info[i];
5008 if (!r_ptr->name) continue;
5010 /* XTRA HACK WHATSEARCH */
5011 /* Require non-unique monsters if needed */
5012 if (norm && (r_ptr->flags1 & (RF1_UNIQUE))) continue;
5014 /* Require unique monsters if needed */
5015 if (uniq && !(r_ptr->flags1 & (RF1_UNIQUE))) continue;
5023 for (xx = 0; temp[xx] && xx < 80; xx++)
5026 if (iskanji(temp[xx]))
5032 if (isupper(temp[xx])) temp[xx] = tolower(temp[xx]);
5036 strcpy(temp2, r_name + r_ptr->E_name);
5038 strcpy(temp2, r_name + r_ptr->name);
5040 for (xx = 0; temp2[xx] && xx < 80; xx++)
5041 if (isupper(temp2[xx])) temp2[xx] = tolower(temp2[xx]);
5044 if (my_strstr(temp2, temp) || my_strstr(r_name + r_ptr->name, temp))
5046 if (my_strstr(temp2, temp))
5050 else if (all || (r_ptr->d_char == sym)) who[n++] = i;
5053 /* Nothing to recall */
5056 /* Free the "who" array */
5057 C_KILL(who, max_r_idx, u16b);
5069 /* Sort if needed */
5072 /* Select the sort method */
5073 ang_sort_comp = ang_sort_comp_hook;
5074 ang_sort_swap = ang_sort_swap_hook;
5076 /* Sort the array */
5077 ang_sort(who, &why, n);
5081 /* Start at the end */
5082 /* XTRA HACK REMEMBER_IDX */
5083 if (old_sym == sym && old_i < n) i = old_i;
5088 /* Scan the monster memory */
5091 /* Extract a race */
5094 /* Hack -- Begin the prompt */
5097 /* Hack -- Complete the prompt */
5099 Term_addstr(-1, TERM_WHITE, " ['r'»×¤¤½Ð, ' '¤Ç³¹Ô, ESC]");
5101 Term_addstr(-1, TERM_WHITE, " [(r)ecall, ESC, space to continue]");
5111 /*** Recall on screen ***/
5113 /* Get maximal info about this monster */
5114 lore_do_probe(r_idx);
5116 /* Save this monster ID */
5117 monster_race_track(r_idx);
5119 /* Hack -- Handle stuff */
5122 /* know every thing mode */
5123 screen_roff(r_idx, 0x01);
5126 /* XTRA HACK REMEMBER_IDX */
5134 /* Normal commands */
5135 if (query != 'r') break;
5142 if (query == ESCAPE) break;
5144 /* Move to "prev" monster */
5150 if (!expand_list) break;
5154 /* Move to "next" monster */
5160 if (!expand_list) break;
5166 /* Re-display the identity */
5167 /* prt(buf, 5, 5);*/
5169 /* Free the "who" array */
5170 C_KILL(who, max_r_idx, u16b);
5175 return (!notpicked);
5180 * Execute a building command
5182 static void bldg_process_command(building_type *bldg, int i)
5184 int bact = bldg->actions[i];
5189 /* Flush messages XXX XXX XXX */
5194 bcost = bldg->member_costs[i];
5196 bcost = bldg->other_costs[i];
5198 /* action restrictions */
5199 if (((bldg->action_restr[i] == 1) && !is_member(bldg)) ||
5200 ((bldg->action_restr[i] == 2) && !is_owner(bldg)))
5203 msg_print("¤½¤ì¤òÁªÂò¤¹¤ë¸¢Íø¤Ï¤¢¤ê¤Þ¤»¤ó¡ª");
5205 msg_print("You have no right to choose that!");
5210 /* check gold (HACK - Recharge uses variable costs) */
5211 if ((bact != BACT_RECHARGE) &&
5212 (((bldg->member_costs[i] > p_ptr->au) && is_owner(bldg)) ||
5213 ((bldg->other_costs[i] > p_ptr->au) && !is_owner(bldg))))
5216 msg_print("¤ª¶â¤¬Â¤ê¤Þ¤»¤ó¡ª");
5218 msg_print("You do not have the gold!");
5228 case BACT_RESEARCH_ITEM:
5229 paid = identify_fully(FALSE);
5231 case BACT_TOWN_HISTORY:
5234 case BACT_RACE_LEGENDS:
5240 case BACT_KING_LEGENDS:
5241 case BACT_ARENA_LEGENDS:
5246 case BACT_ARENA_RULES:
5250 case BACT_IN_BETWEEN:
5252 case BACT_SPIN_WHEEL:
5253 case BACT_DICE_SLOTS:
5254 case BACT_GAMBLE_RULES:
5261 paid = inn_comm(bact);
5263 case BACT_RESEARCH_MONSTER:
5264 paid = research_mon();
5266 case BACT_COMPARE_WEAPONS:
5268 bcost = compare_weapons(bcost);
5270 case BACT_ENCHANT_WEAPON:
5271 item_tester_hook = object_allow_enchant_melee_weapon;
5272 enchant_item(bcost, 1, 1, 0);
5274 case BACT_ENCHANT_ARMOR:
5275 item_tester_hook = object_is_armour;
5276 enchant_item(bcost, 0, 0, 1);
5279 building_recharge();
5281 case BACT_RECHARGE_ALL:
5282 building_recharge_all();
5284 case BACT_IDENTS: /* needs work */
5286 if (!get_check("»ý¤Áʪ¤òÁ´¤Æ´ÕÄꤷ¤Æ¤è¤í¤·¤¤¤Ç¤¹¤«¡©")) break;
5288 msg_print(" »ý¤ÁʪÁ´¤Æ¤¬´ÕÄꤵ¤ì¤Þ¤·¤¿¡£");
5290 if (!get_check("Do you pay for identify all your possession? ")) break;
5292 msg_print("Your possessions have been identified.");
5297 case BACT_IDENT_ONE: /* needs work */
5298 paid = ident_spell(FALSE);
5303 case BACT_HEALING: /* needs work */
5312 case BACT_RESTORE: /* needs work */
5313 if (do_res_stat(A_STR)) paid = TRUE;
5314 if (do_res_stat(A_INT)) paid = TRUE;
5315 if (do_res_stat(A_WIS)) paid = TRUE;
5316 if (do_res_stat(A_DEX)) paid = TRUE;
5317 if (do_res_stat(A_CON)) paid = TRUE;
5318 if (do_res_stat(A_CHR)) paid = TRUE;
5320 case BACT_ENCHANT_ARROWS:
5321 item_tester_hook = item_tester_hook_ammo;
5322 enchant_item(bcost, 1, 1, 0);
5324 case BACT_ENCHANT_BOW:
5325 item_tester_tval = TV_BOW;
5326 enchant_item(bcost, 1, 1, 0);
5329 if (recall_player(1)) paid = TRUE;
5331 case BACT_TELEPORT_LEVEL:
5338 select_dungeon = choose_dungeon("¤Ë¥Æ¥ì¥Ý¡¼¥È", 4, 0);
5340 select_dungeon = choose_dungeon("teleport", 4, 0);
5342 show_building(bldg);
5343 if (!select_dungeon) return;
5345 max_depth = d_info[select_dungeon].maxdepth;
5347 /* Limit depth in Angband */
5348 if (select_dungeon == DUNGEON_ANGBAND)
5350 if (quest[QUEST_OBERON].status != QUEST_STATUS_FINISHED) max_depth = 98;
5351 else if(quest[QUEST_SERPENT].status != QUEST_STATUS_FINISHED) max_depth = 99;
5355 amt = get_quantity(format("%s¤Î²¿³¬¤Ë¥Æ¥ì¥Ý¡¼¥È¤·¤Þ¤¹¤«¡©", d_name + d_info[select_dungeon].name), max_depth);
5357 amt = get_quantity(format("Teleport to which level of %s? ", d_name + d_info[select_dungeon].name), max_depth);
5362 p_ptr->word_recall = 1;
5363 p_ptr->recall_dungeon = select_dungeon;
5364 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));
5365 if (record_maxdepth)
5367 do_cmd_write_nikki(NIKKI_TRUMP, select_dungeon, "¥È¥é¥ó¥×¥¿¥ï¡¼¤Ç");
5369 do_cmd_write_nikki(NIKKI_TRUMP, select_dungeon, "at Trump Tower");
5372 msg_print("²ó¤ê¤ÎÂ絤¤¬Ä¥¤ê¤Ä¤á¤Æ¤¤¿...");
5374 msg_print("The air about you becomes charged...");
5378 p_ptr->redraw |= (PR_STATUS);
5382 case BACT_LOSE_MUTATION:
5383 if (p_ptr->muta1 || p_ptr->muta2 ||
5384 (p_ptr->muta3 & ~MUT3_GOOD_LUCK) ||
5385 (p_ptr->pseikaku != SEIKAKU_LUCKY &&
5386 (p_ptr->muta3 & MUT3_GOOD_LUCK)))
5388 while(!lose_mutation(0));
5394 msg_print("¼£¤¹¤Ù¤ÆÍÁ³ÊÑ°Û¤¬Ìµ¤¤¡£");
5396 msg_print("You have no mutations.");
5404 case BACT_TSUCHINOKO:
5418 msg_print("Ê¿¹Õ²½¤Îµ·¼°¤ò¹Ô¤Ê¤Ã¤¿¡£");
5420 msg_print("You received an equalization ritual.");
5422 set_virtue(V_COMPASSION, 0);
5423 set_virtue(V_HONOUR, 0);
5424 set_virtue(V_JUSTICE, 0);
5425 set_virtue(V_SACRIFICE, 0);
5426 set_virtue(V_KNOWLEDGE, 0);
5427 set_virtue(V_FAITH, 0);
5428 set_virtue(V_ENLIGHTEN, 0);
5429 set_virtue(V_ENCHANT, 0);
5430 set_virtue(V_CHANCE, 0);
5431 set_virtue(V_NATURE, 0);
5432 set_virtue(V_HARMONY, 0);
5433 set_virtue(V_VITALITY, 0);
5434 set_virtue(V_UNLIFE, 0);
5435 set_virtue(V_PATIENCE, 0);
5436 set_virtue(V_TEMPERANCE, 0);
5437 set_virtue(V_DILIGENCE, 0);
5438 set_virtue(V_VALOUR, 0);
5439 set_virtue(V_INDIVIDUALISM, 0);
5443 case BACT_TELE_TOWN:
5447 paid = eval_ac(p_ptr->dis_ac + p_ptr->dis_to_a);
5449 case BACT_BROKEN_WEAPON:
5451 bcost = repair_broken_weapon(bcost);
5465 void do_cmd_quest(void)
5469 if (!cave_have_flag_bold(py, px, FF_QUEST_ENTER))
5472 msg_print("¤³¤³¤Ë¤Ï¥¯¥¨¥¹¥È¤ÎÆþ¸ý¤Ï¤Ê¤¤¡£");
5474 msg_print("You see no quest level here.");
5482 msg_print("¤³¤³¤Ë¤Ï¥¯¥¨¥¹¥È¤Ø¤ÎÆþ¸ý¤¬¤¢¤ê¤Þ¤¹¡£");
5483 if (!get_check("¥¯¥¨¥¹¥È¤ËÆþ¤ê¤Þ¤¹¤«¡©")) return;
5484 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
5485 msg_print("¡Ø¤È¤Ë¤«¤¯Æþ¤Ã¤Æ¤ß¤è¤¦¤¼¤§¡£¡Ù");
5487 msg_print("There is an entry of a quest.");
5488 if (!get_check("Do you enter? ")) return;
5491 /* Player enters a new quest */
5495 leave_quest_check();
5497 if (quest[p_ptr->inside_quest].type != QUEST_TYPE_RANDOM) dun_level = 1;
5498 p_ptr->inside_quest = cave[py][px].special;
5500 p_ptr->leaving = TRUE;
5506 * Do building commands
5508 void do_cmd_bldg(void)
5513 building_type *bldg;
5518 if (!cave_have_flag_bold(py, px, FF_BLDG))
5521 msg_print("¤³¤³¤Ë¤Ï·úʪ¤Ï¤Ê¤¤¡£");
5523 msg_print("You see no building here.");
5529 which = f_info[cave[py][px].feat].subtype;
5531 bldg = &building[which];
5533 /* Don't re-init the wilderness */
5534 reinit_wilderness = FALSE;
5536 if ((which == 2) && (p_ptr->arena_number < 0))
5539 msg_print("¡ÖÇÔ¼Ô¤ËÍѤϤʤ¤¡£¡×");
5541 msg_print("'There's no place here for a LOSER like you!'");
5545 else if ((which == 2) && p_ptr->inside_arena)
5547 if (!p_ptr->exit_bldg && m_cnt > 0)
5550 prt("¥²¡¼¥È¤ÏÊĤޤäƤ¤¤ë¡£¥â¥ó¥¹¥¿¡¼¤¬¤¢¤Ê¤¿¤òÂԤäƤ¤¤ë¡ª", 0, 0);
5552 prt("The gates are closed. The monster awaits!", 0, 0);
5557 /* Don't save the arena as saved floor */
5558 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_NO_RETURN);
5560 p_ptr->inside_arena = FALSE;
5561 p_ptr->leaving = TRUE;
5563 /* Re-enter the arena */
5564 command_new = SPECIAL_KEY_BUILDING;
5566 /* No energy needed to re-enter the arena */
5572 else if (p_ptr->inside_battle)
5574 /* Don't save the arena as saved floor */
5575 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_NO_RETURN);
5577 p_ptr->leaving = TRUE;
5578 p_ptr->inside_battle = FALSE;
5580 /* Re-enter the monster arena */
5581 command_new = SPECIAL_KEY_BUILDING;
5583 /* No energy needed to re-enter the arena */
5594 /* Forget the lite */
5597 /* Forget the view */
5600 /* Hack -- Increase "icky" depth */
5607 show_building(bldg);
5615 building_prt_gold();
5619 if (command == ESCAPE)
5622 p_ptr->inside_arena = FALSE;
5623 p_ptr->inside_battle = FALSE;
5627 for (i = 0; i < 8; i++)
5629 if (bldg->letters[i])
5631 if (bldg->letters[i] == command)
5640 bldg_process_command(bldg, i);
5649 /* Flush messages XXX XXX XXX */
5653 /* Reinit wilderness to activate quests ... */
5654 if (reinit_wilderness)
5656 p_ptr->leaving = TRUE;
5659 /* Hack -- Decrease "icky" depth */
5662 /* Clear the screen */
5665 /* Update the visuals */
5666 p_ptr->update |= (PU_VIEW | PU_MONSTERS | PU_BONUS | PU_LITE | PU_MON_LITE);
5668 /* Redraw entire screen */
5669 p_ptr->redraw |= (PR_BASIC | PR_EXTRA | PR_EQUIPPY | PR_MAP);
5672 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
5676 /* Array of places to find an inscription */
5677 static cptr find_quest[] =
5680 "¾²¤Ë¥á¥Ã¥»¡¼¥¸¤¬¹ï¤Þ¤ì¤Æ¤¤¤ë:",
5682 "You find the following inscription in the floor",
5686 "Êɤ˥á¥Ã¥»¡¼¥¸¤¬¹ï¤Þ¤ì¤Æ¤¤¤ë:",
5688 "You see a message inscribed in the wall",
5692 "¥á¥Ã¥»¡¼¥¸¤ò¸«¤Ä¤±¤¿:",
5694 "There is a sign saying",
5698 "²¿¤«¤¬³¬Ãʤξå¤Ë½ñ¤¤¤Æ¤¢¤ë:",
5700 "Something is written on the staircase",
5704 "´¬Êª¤ò¸«¤Ä¤±¤¿¡£¥á¥Ã¥»¡¼¥¸¤¬½ñ¤¤¤Æ¤¢¤ë:",
5706 "You find a scroll with the following message",
5715 void quest_discovery(int q_idx)
5717 quest_type *q_ptr = &quest[q_idx];
5718 monster_race *r_ptr = &r_info[q_ptr->r_idx];
5719 int q_num = q_ptr->max_num;
5722 /* No quest index */
5725 strcpy(name, (r_name + r_ptr->name));
5727 msg_print(find_quest[rand_range(0, 4)]);
5734 /* Hack -- "unique" monsters must be "unique" */
5735 if ((r_ptr->flags1 & RF1_UNIQUE) &&
5736 (0 == r_ptr->max_num))
5739 msg_print("¤³¤Î³¬¤Ï°ÊÁ°¤Ï狼¤Ë¤è¤Ã¤Æ¼é¤é¤ì¤Æ¤¤¤¿¤è¤¦¤À¡Ä¡£");
5741 msg_print("It seems that this level was protected by someone before...");
5743 /* The unique is already dead */
5744 quest[q_idx].status = QUEST_STATUS_FINISHED;
5747 q_ptr->comptime = playtime;
5752 msg_format("Ãí°Õ¤»¤è¡ª¤³¤Î³¬¤Ï%s¤Ë¤è¤Ã¤Æ¼é¤é¤ì¤Æ¤¤¤ë¡ª", name);
5754 msg_format("Beware, this level is protected by %s!", name);
5760 /* Normal monsters */
5762 msg_format("Ãí°Õ¤·¤í¡ª¤³¤Î³¬¤Ï%dÂΤÎ%s¤Ë¤è¤Ã¤Æ¼é¤é¤ì¤Æ¤¤¤ë¡ª", q_num, name);
5765 msg_format("Be warned, this level is guarded by %d %s!", q_num, name);
5773 * Hack -- Check if a level is a "quest" level
5775 int quest_number(int level)
5780 if (p_ptr->inside_quest)
5781 return (p_ptr->inside_quest);
5783 for (i = 0; i < max_quests; i++)
5785 if (quest[i].status != QUEST_STATUS_TAKEN) continue;
5787 if ((quest[i].type == QUEST_TYPE_KILL_LEVEL) &&
5788 !(quest[i].flags & QUEST_FLAG_PRESET) &&
5789 (quest[i].level == level) &&
5790 (quest[i].dungeon == dungeon_type))
5794 /* Check for random quest */
5795 return (random_quest_number(level));
5800 * Return the index of the random quest on this level
5803 int random_quest_number(int level)
5807 if (dungeon_type != DUNGEON_ANGBAND) return 0;
5809 for (i = MIN_RANDOM_QUEST; i < MAX_RANDOM_QUEST + 1; i++)
5811 if ((quest[i].type == QUEST_TYPE_RANDOM) &&
5812 (quest[i].status == QUEST_STATUS_TAKEN) &&
5813 (quest[i].level == level) &&
5814 (quest[i].dungeon == DUNGEON_ANGBAND))