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
595 #define SUIT_OF(card) ((card) / 13) /*!< ¥È¥é¥ó¥×¥«¡¼¥É¤Î¥¹¡¼¥È¤òÊÖ¤¹ */
596 #define NUM_OF(card) ((card) % 13) /*!< ¥È¥é¥ó¥×¥«¡¼¥É¤ÎÈÖ¹æ¤òÊÖ¤¹ */
597 #define IS_JOKER(card) ((card) == 52) /*!< ¥È¥é¥ó¥×¥«¡¼¥É¤¬¥¸¥ç¡¼¥«¡¼¤«¤É¤¦¤«¤òÊÖ¤¹ */
599 static int cards[5]; /*!< ¥Ý¡¼¥«¡¼¤Î¸½ºß¤Î¼ê»¥ID */
602 * @brief ¥Ý¡¼¥«¡¼¤Î»³»¥¤òÀڤ롣
606 static void reset_deck(int deck[])
609 for (i = 0; i < 53; i++) deck[i] = i;
612 for (i = 0; i < 53; i++){
613 int tmp1 = randint0(53 - i) + i;
615 deck[i] = deck[tmp1];
621 * @brief ¥Ý¡¼¥«¡¼¥×¥ì¥¤Ãæ¤Ë¥¸¥ç¡¼¥«¡¼¤ò»ý¤Ã¤Æ¤¤¤ë¤«¤ÎȽÄê¤òÊÖ¤¹¡£
623 * @return ¥¸¥ç¡¼¥«¡¼¤ò»ý¤Ã¤Æ¤¤¤ë¤«¡£
625 static bool have_joker(void)
629 for (i = 0; i < 5; i++){
630 if(IS_JOKER(cards[i])) return TRUE;
636 * @brief ¥Ý¡¼¥«¡¼¤Î¼ê»¥¤Ë³ºÅö¤ÎÈÖ¹æ¤Î»¥¤¬¤¢¤ë¤«¤òÊÖ¤¹¡£
637 * @param õ¤·¤¿¤¤¥«¡¼¥É¤ÎÈֹ档
638 * @return ³ºÅö¤ÎÈֹ椬¼ê»¥¤Ë¤¢¤ë¤«¡£
640 static bool find_card_num(int num)
643 for (i = 0; i < 5; i++)
644 if (NUM_OF(cards[i]) == num && !IS_JOKER(cards[i])) return TRUE;
649 * @brief ¥Ý¡¼¥«¡¼¤Î¼ê»¥¤¬¥Õ¥é¥Ã¥·¥åÌò¤òÆÀ¤Æ¤¤¤ë¤«¤òµ¢¤¹¡£
651 * @return Ìò¤ÎȽÄê·ë²Ì
653 static bool yaku_check_flush(void)
656 bool joker_is_used = FALSE;
658 suit = IS_JOKER(cards[0]) ? SUIT_OF(cards[1]) : SUIT_OF(cards[0]);
659 for (i = 0; i < 5; i++){
660 if (SUIT_OF(cards[i]) != suit){
661 if(have_joker() && !joker_is_used)
662 joker_is_used = TRUE;
672 * @brief ¥Ý¡¼¥«¡¼¤Î¼ê»¥¤¬¥¹¥È¥ì¡¼¥ÈÌò¤òÆÀ¤Æ¤¤¤ë¤«¤òµ¢¤¹¡£
674 * @return Ìò¤ÎȽÄê·ë²Ì
676 static int yaku_check_straight(void)
679 bool joker_is_used = FALSE;
682 for (i = 0; i < 5; i++)
684 if (NUM_OF(cards[i]) < lowest && !IS_JOKER(cards[i]))
685 lowest = NUM_OF(cards[i]);
688 if (yaku_check_flush())
691 for (i = 0; i < 4; i++)
693 if (!find_card_num(9 + i)){
694 if( have_joker() && !joker_is_used )
695 joker_is_used = TRUE;
700 if (i == 4) return 3; /* Wow! Royal Flush!!! */
703 for (i = 0; i < 3; i++)
705 if (!find_card_num(10 + i))
708 if (i == 3 && have_joker()) return 3; /* Wow! Royal Flush!!! */
712 joker_is_used = FALSE;
713 for (i = 0; i < 5; i++)
715 if (!find_card_num(lowest + i)){
716 if( have_joker() && !joker_is_used )
717 joker_is_used = TRUE;
723 if (yaku_check_flush())
724 return 2; /* Straight Flush */
730 * @brief ¥Ý¡¼¥«¡¼¤Î¥Ú¥¢Ìò¤Î¾õÂÖ¤òÊÖ¤¹¡£
732 * @return 0:nopair 1:1 pair 2:2 pair 3:3 cards 4:full house 6:4cards
734 static int yaku_check_pair(void)
736 int i, i2, matching = 0;
738 for (i = 0; i < 5; i++)
740 for (i2 = i+1; i2 < 5; i2++)
742 if (IS_JOKER(cards[i]) || IS_JOKER(cards[i2])) continue;
743 if (NUM_OF(cards[i]) == NUM_OF(cards[i2]))
774 #define ODDS_5A 3000 /*!< ¥Õ¥¡¥¤¥Ö¥¨¡¼¥¹¤ÎÌòÇÜΨ */
775 #define ODDS_5C 400 /*!< ¥Õ¥¡¥¤¥Ö¥«¡¼¥É¤ÎÌòÇÜΨ */
776 #define ODDS_RF 200 /*!< ¥í¥¤¥ä¥ë¥¹¥È¥ì¡¼¥È¥Õ¥é¥Ã¥·¥å¤ÎÌòÇÜΨ */
777 #define ODDS_SF 80 /*!< ¥¹¥È¥ì¡¼¥È¥Õ¥é¥Ã¥·¥å¤ÎÌòÇÜΨ */
778 #define ODDS_4C 16 /*!< ¥Õ¥©¥¢¥«¡¼¥É¤ÎÌòÇÜΨ */
779 #define ODDS_FH 12 /*!< ¥Õ¥ë¥Ï¥¦¥¹¤ÎÌòÇÜΨ */
780 #define ODDS_FL 8 /*!< ¥Õ¥é¥Ã¥·¥å¤ÎÌòÇÜΨ */
781 #define ODDS_ST 4 /*!< ¥¹¥È¥ì¡¼¥È¤ÎÌòÇÜΨ */
782 #define ODDS_3C 1 /*!< ¥¹¥ê¡¼¥«¡¼¥É¤ÎÌòÇÜΨ */
783 #define ODDS_2P 1 /*!< ¥Ä¡¼¥Ú¥¢¤ÎÌòÇÜΨ */
786 * @brief ¥Ý¡¼¥«¡¼¤ÎÌò¤ò¥Á¥§¥Ã¥¯¤·¡¢¤½¤Î·ë²Ì¤ò²èÌ̤Ëɽ¼¨¤·¤Ä¤Ä·ë²Ì¤òÊÖ¤¹¡£
790 static int yaku_check(void)
794 switch(yaku_check_straight()){
797 c_put_str(TERM_YELLOW, "¥í¥¤¥ä¥ë¥¹¥È¥ì¡¼¥È¥Õ¥é¥Ã¥·¥å", 4, 3);
799 c_put_str(TERM_YELLOW, "Royal Flush", 4, 3);
804 c_put_str(TERM_YELLOW, "¥¹¥È¥ì¡¼¥È¥Õ¥é¥Ã¥·¥å", 4, 3);
806 c_put_str(TERM_YELLOW, "Straight Flush", 4, 3);
811 c_put_str(TERM_YELLOW, "¥¹¥È¥ì¡¼¥È", 4, 3);
813 c_put_str(TERM_YELLOW, "Straight", 4, 3);
817 /* Not straight -- fall through */
821 if (yaku_check_flush())
825 c_put_str(TERM_YELLOW, "¥Õ¥é¥Ã¥·¥å", 4, 3);
827 c_put_str(TERM_YELLOW, "Flush", 4, 3);
832 switch (yaku_check_pair())
836 c_put_str(TERM_YELLOW, "¥ï¥ó¥Ú¥¢", 4, 3);
838 c_put_str(TERM_YELLOW, "One pair", 4, 3);
843 c_put_str(TERM_YELLOW, "¥Ä¡¼¥Ú¥¢", 4, 3);
845 c_put_str(TERM_YELLOW, "Two pair", 4, 3);
850 c_put_str(TERM_YELLOW, "¥¹¥ê¡¼¥«¡¼¥É", 4, 3);
852 c_put_str(TERM_YELLOW, "Three of a kind", 4, 3);
857 c_put_str(TERM_YELLOW, "¥Õ¥ë¥Ï¥¦¥¹", 4, 3);
859 c_put_str(TERM_YELLOW, "Full house", 4, 3);
864 c_put_str(TERM_YELLOW, "¥Õ¥©¡¼¥«¡¼¥É", 4, 3);
866 c_put_str(TERM_YELLOW, "Four of a kind", 4, 3);
870 if (!NUM_OF(cards[0]) || !NUM_OF(cards[1]))
873 c_put_str(TERM_YELLOW, "¥Õ¥¡¥¤¥Ö¥¨¡¼¥¹", 4, 3);
875 c_put_str(TERM_YELLOW, "Five ace", 4, 3);
882 c_put_str(TERM_YELLOW, "¥Õ¥¡¥¤¥Ö¥«¡¼¥É", 4, 3);
884 c_put_str(TERM_YELLOW, "Five of a kind", 4, 3);
895 * @brief ¥Ý¡¼¥«¡¼¤Î¼Î¤Æ¤ë/»Ä¤¹¥¤¥ó¥¿¡¼¥Õ¥§¥¤¥¹¤Îɽ¼¨¤ò¹¹¿·¤¹¤ë¡£
896 * @param hoge ¥«¡¼¥½¥ë¤Î¸½ºß°ÌÃÖ
897 * @param kaeruka ¥«¡¼¥É¤Î¼Î¤Æ¤ë/»Ä¤¹¥Õ¥é¥°ÇÛÎó
900 static void display_kaeruka(int hoge, int kaeruka[])
903 char col = TERM_WHITE;
904 for (i = 0; i < 5; i++)
906 if (i == hoge) col = TERM_YELLOW;
907 else if(kaeruka[i]) col = TERM_WHITE;
908 else col = TERM_L_BLUE;
911 c_put_str(col, "¤«¤¨¤ë", 14, 5+i*16);
913 c_put_str(col, "¤Î¤³¤¹", 14, 5+i*16);
916 c_put_str(col, "Change", 14, 5+i*16);
918 c_put_str(col, " Stay ", 14, 5+i*16);
921 if (hoge > 4) col = TERM_YELLOW;
922 else col = TERM_WHITE;
924 c_put_str(col, "·èÄê", 16, 38);
926 c_put_str(col, "Sure", 16, 38);
929 /* Hilite current option */
930 if (hoge < 5) move_cursor(14, 5+hoge*16);
931 else move_cursor(16, 38);
935 * @brief ¥Ý¡¼¥«¡¼¤Î¼ê»¥¤òɽ¼¨¤¹¤ë¡£
939 static void display_cards(void)
942 char suitcolor[4] = {TERM_YELLOW, TERM_L_RED, TERM_L_BLUE, TERM_L_GREEN};
944 cptr suit[4] = {"¡ú", "¡ü", "¢ù", "¢÷"};
945 cptr card_grph[13][7] = {{"£Á %s ",
1036 cptr joker_grph[7] = { " ",
1046 cptr suit[4] = {"[]", "qp", "<>", "db"};
1047 cptr card_grph[13][7] = {{"A %s ",
1138 cptr joker_grph[7] = { " ",
1147 for (i = 0; i < 5; i++)
1150 prt("¨®¨¬¨¬¨¬¨¬¨¬¨¬¨¯", 5, i*16);
1152 prt(" +------------+ ", 5, i*16);
1156 for (i = 0; i < 5; i++)
1158 for (j = 0; j < 7; j++)
1161 prt("¨", j+6, i*16);
1163 prt(" |", j+6, i*16);
1165 if(IS_JOKER(cards[i]))
1166 c_put_str(TERM_VIOLET, joker_grph[j], j+6, 2+i*16);
1168 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);
1170 prt("¨", j+6, i*16+14);
1172 prt("| ", j+6, i*16+14);
1176 for (i = 0; i < 5; i++)
1179 prt("¨±¨¬¨¬¨¬¨¬¨¬¨¬¨°", 13, i*16);
1181 prt(" +------------+ ", 13, i*16);
1187 * @brief ¥Ý¡¼¥«¡¼¤Î£±¥×¥ì¥¤¥ë¡¼¥Á¥ó¡£
1189 * @return £±¥×¥ì¥¤¤ÎÌò¤Î·ë²Ì
1191 static int do_poker(void)
1195 int deck[53]; /* yamafuda : 0...52 */
1197 int kaeruka[5]; /* 0:kaenai 1:kaeru */
1201 bool kakikae = TRUE;
1205 for (i = 0; i < 5; i++)
1207 cards[i] = deck[deck_ptr++];
1208 kaeruka[i] = 0; /* default:nokosu */
1228 /* debug:Four Cards */
1230 cards[1] = 0 + 13 * 1;
1231 cards[2] = 0 + 13 * 2;
1232 cards[3] = 0 + 13 * 3;
1236 /* debug:Straight */
1252 /* suteruno wo kimeru */
1254 prt("»Ä¤¹¥«¡¼¥É¤ò·è¤á¤Æ²¼¤µ¤¤(Êý¸þ¤Ç°ÜÆ°, ¥¹¥Ú¡¼¥¹¤ÇÁªÂò)¡£", 0, 0);
1256 prt("Stay witch? ", 0, 0);
1264 if (kakikae) display_kaeruka(k+kettei*5, kaeruka);
1269 case '6': case 'l': case 'L': case KTRL('F'):
1270 if (!kettei) k = (k+1)%5;
1271 else {k = 0;kettei = FALSE;}
1274 case '4': case 'h': case 'H': case KTRL('B'):
1275 if (!kettei) k = (k+4)%5;
1276 else {k = 4;kettei = FALSE;}
1279 case '2': case 'j': case 'J': case KTRL('N'):
1280 if (!kettei) {kettei = TRUE;kakikae = TRUE;}
1282 case '8': case 'k': case 'K': case KTRL('P'):
1283 if (kettei) {kettei = FALSE;kakikae = TRUE;}
1285 case ' ': case '\r':
1286 if (kettei) done = TRUE;
1287 else {kaeruka[k] = !kaeruka[k];kakikae = TRUE;}
1296 for (i = 0; i < 5; i++)
1297 if (kaeruka[i] == 1) cards[i] = deck[deck_ptr++]; /* soshite toru */
1301 return yaku_check();
1306 /* end of poker codes --Koka */
1309 * @brief ¥«¥¸¥Î£±¥×¥ì¥¤¤´¤È¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó / gamble_comm
1310 * @param cmd ¥×¥ì¥¤¤¹¤ë¥²¡¼¥àID
1313 static bool gamble_comm(int cmd)
1316 int roll1, roll2, roll3, choice, odds, win;
1321 char out_val[160], tmp_str[80], again;
1326 if (cmd == BACT_GAMBLE_RULES)
1328 /* Peruse the gambling help file */
1330 (void)show_file(TRUE, "jgambling.txt", NULL, 0, 0);
1332 (void)show_file(TRUE, "gambling.txt", NULL, 0, 0);
1342 msg_print("¤ª¤¤¡ª¤ª¤Þ¤¨°ìʸ¤Ê¤·¤¸¤ã¤Ê¤¤¤«¡ª¤³¤Ã¤«¤é½Ð¤Æ¤¤¤±¡ª");
1344 msg_print("Hey! You don't have gold - get out of here!");
1354 maxbet = p_ptr->lev * 200;
1356 /* We can't bet more than we have */
1357 maxbet = MIN(maxbet, p_ptr->au);
1360 strcpy(out_val, "");
1362 sprintf(tmp_str,"ÅÒ¤±¶â (1-%ld)¡©", (long int)maxbet);
1364 sprintf(tmp_str,"Your wager (1-%ld) ? ", (long int)maxbet);
1369 * Use get_string() because we may need more than
1370 * the s16b value returned by get_quantity().
1372 if (get_string(tmp_str, out_val, 32))
1375 for (p = out_val; *p == ' '; p++);
1380 if (wager > p_ptr->au)
1383 msg_print("¤ª¤¤¡ª¶â¤¬Â¤ê¤Ê¤¤¤¸¤ã¤Ê¤¤¤«¡ª½Ð¤Æ¤¤¤±¡ª");
1385 msg_print("Hey! You don't have the gold - get out of here!");
1392 else if (wager > maxbet)
1395 msg_format("%ld¥´¡¼¥ë¥É¤À¤±¼õ¤±¤è¤¦¡£»Ä¤ê¤Ï¼è¤Ã¤È¤¤Ê¡£", (long int)maxbet);
1397 msg_format("I'll take %ld gold of that. Keep the rest.", (long int)maxbet);
1405 msg_print("£Ï£Ë¡¢£±¥´¡¼¥ë¥É¤«¤é¤Ï¤¸¤á¤è¤¦¡£");
1407 msg_print("Ok, we'll start with 1 gold.");
1416 oldgold = p_ptr->au;
1419 sprintf(tmp_str, "¥²¡¼¥àÁ°¤Î½ê»ý¶â: %9ld", (long int)oldgold);
1421 sprintf(tmp_str, "Gold before game: %9ld", (long int)oldgold);
1424 prt(tmp_str, 20, 2);
1427 sprintf(tmp_str, "¸½ºß¤Î³Ý¤±¶â: %9ld", (long int)wager);
1429 sprintf(tmp_str, "Current Wager: %9ld", (long int)wager);
1432 prt(tmp_str, 21, 2);
1439 case BACT_IN_BETWEEN: /* Game of In-Between */
1441 c_put_str(TERM_GREEN, "¥¤¥ó¡¦¥Ó¥È¥¤¡¼¥ó",5,2);
1443 c_put_str(TERM_GREEN, "In Between", 5, 2);
1448 roll1 = randint1(10);
1449 roll2 = randint1(10);
1450 choice = randint1(10);
1452 sprintf(tmp_str, "¹õ¥À¥¤¥¹: %d ¹õ¥À¥¤¥¹: %d", roll1, roll2);
1454 sprintf(tmp_str, "Black die: %d Black Die: %d", roll1, roll2);
1459 sprintf(tmp_str, "ÀÖ¥À¥¤¥¹: %d", choice);
1461 sprintf(tmp_str, "Red die: %d", choice);
1464 prt(tmp_str, 11, 14);
1465 if (((choice > roll1) && (choice < roll2)) ||
1466 ((choice < roll1) && (choice > roll2)))
1469 case BACT_CRAPS: /* Game of Craps */
1471 c_put_str(TERM_GREEN, "¥¯¥é¥Ã¥×¥¹", 5, 2);
1473 c_put_str(TERM_GREEN, "Craps", 5, 2);
1478 roll1 = randint1(6);
1479 roll2 = randint1(6);
1480 roll3 = roll1 + roll2;
1483 sprintf(tmp_str, "£±¿¶¤ê¤á: %d %d Total: %d", roll1,
1485 sprintf(tmp_str, "First roll: %d %d Total: %d", roll1,
1490 if ((roll3 == 7) || (roll3 == 11))
1492 else if ((roll3 == 2) || (roll3 == 3) || (roll3 == 12))
1498 msg_print("¤Ê¤Ë¤«¥¡¼¤ò²¡¤¹¤È¤â¤¦°ì²ó¿¶¤ê¤Þ¤¹¡£");
1500 msg_print("Hit any key to roll again");
1504 roll1 = randint1(6);
1505 roll2 = randint1(6);
1506 roll3 = roll1 + roll2;
1509 sprintf(tmp_str, "½ÐÌÜ: %d %d ¹ç·×: %d",
1511 sprintf(tmp_str, "Roll result: %d %d Total: %d",
1514 roll1, roll2, roll3);
1516 if (roll3 == choice)
1518 else if (roll3 == 7)
1520 } while ((win != TRUE) && (win != FALSE));
1523 case BACT_SPIN_WHEEL: /* Spin the Wheel Game */
1527 c_put_str(TERM_GREEN, "¥ë¡¼¥ì¥Ã¥È", 5, 2);
1529 c_put_str(TERM_GREEN, "Wheel", 5, 2);
1532 prt("0 1 2 3 4 5 6 7 8 9", 7, 5);
1533 prt("--------------------------------", 8, 3);
1534 strcpy(out_val, "");
1536 get_string("²¿ÈÖ¡© (0-9): ", out_val, 32);
1538 get_string("Pick a number (0-9): ", out_val, 32);
1541 for (p = out_val; iswspace(*p); p++);
1546 msg_print("0È֤ˤ·¤È¤¯¤¼¡£");
1548 msg_print("I'll put you down for 0.");
1553 else if (choice > 9)
1556 msg_print("£Ï£Ë¡¢9È֤ˤ·¤È¤¯¤¼¡£");
1558 msg_print("Ok, I'll put you down for 9.");
1564 roll1 = randint0(10);
1566 sprintf(tmp_str, "¥ë¡¼¥ì¥Ã¥È¤Ï²ó¤ê¡¢»ß¤Þ¤Ã¤¿¡£¾¡¼Ô¤Ï %dÈÖ¤À¡£",
1568 sprintf(tmp_str, "The wheel spins to a stop and the winner is %d",
1572 prt(tmp_str, 13, 3);
1574 prt("*", 9, (3 * roll1 + 5));
1575 if (roll1 == choice)
1579 case BACT_DICE_SLOTS: /* The Dice Slots */
1581 c_put_str(TERM_GREEN, "¥À¥¤¥¹¡¦¥¹¥í¥Ã¥È", 5, 2);
1582 c_put_str(TERM_YELLOW, "¥ì¥â¥ó ¥ì¥â¥ó 2", 6, 37);
1583 c_put_str(TERM_YELLOW, "¥ì¥â¥ó ¥ì¥â¥ó ¥ì¥â¥ó 5", 7, 37);
1584 c_put_str(TERM_ORANGE, "¥ª¥ì¥ó¥¸ ¥ª¥ì¥ó¥¸ ¥ª¥ì¥ó¥¸ 10", 8, 37);
1585 c_put_str(TERM_UMBER, "·õ ·õ ·õ 20", 9, 37);
1586 c_put_str(TERM_SLATE, "½â ½â ½â 50", 10, 37);
1587 c_put_str(TERM_VIOLET, "¥×¥é¥à ¥×¥é¥à ¥×¥é¥à 200", 11, 37);
1588 c_put_str(TERM_RED, "¥Á¥§¥ê¡¼ ¥Á¥§¥ê¡¼ ¥Á¥§¥ê¡¼ 1000", 12, 37);
1590 c_put_str(TERM_GREEN, "Dice Slots", 5, 2);
1594 roll1 = randint1(21);
1604 roll2 = randint1(21);
1614 choice = randint1(21);
1624 put_str("/--------------------------\\", 7, 2);
1625 prt("\\--------------------------/", 17, 2);
1626 display_fruit(8, 3, roll1 - 1);
1627 display_fruit(8, 12, roll2 - 1);
1628 display_fruit(8, 21, choice - 1);
1629 if ((roll1 == roll2) && (roll2 == choice))
1648 else if ((roll1 == 1) && (roll2 == 1))
1657 if (odds) win = TRUE;
1664 prt("¤¢¤Ê¤¿¤Î¾¡¤Á", 16, 37);
1666 prt("YOU WON", 16, 37);
1669 p_ptr->au += odds * wager;
1671 sprintf(tmp_str, "ÇÜΨ: %d", odds);
1673 sprintf(tmp_str, "Payoff: %d", odds);
1676 prt(tmp_str, 17, 37);
1681 prt("¤¢¤Ê¤¿¤ÎÉ餱", 16, 37);
1683 prt("You Lost", 16, 37);
1689 sprintf(tmp_str, "¸½ºß¤Î½ê»ý¶â: %9ld", (long int)p_ptr->au);
1691 sprintf(tmp_str, "Current Gold: %9ld", (long int)p_ptr->au);
1694 prt(tmp_str, 22, 2);
1696 prt("¤â¤¦°ìÅÙ(Y/N)¡©", 18, 37);
1698 prt("Again(Y/N)?", 18, 37);
1701 move_cursor(18, 52);
1706 if (wager > p_ptr->au)
1709 msg_print("¤ª¤¤¡ª¶â¤¬Â¤ê¤Ê¤¤¤¸¤ã¤Ê¤¤¤«¡ª¤³¤³¤«¤é½Ð¤Æ¹Ô¤±¡ª");
1711 msg_print("Hey! You don't have the gold - get out of here!");
1719 } while ((again == 'y') || (again == 'Y'));
1722 if (p_ptr->au >= oldgold)
1725 msg_print("¡Öº£²ó¤ÏÌÙ¤±¤¿¤Ê¡ª¤Ç¤â¼¡¤Ï¤³¤Ã¤Á¤¬¾¡¤Ã¤Æ¤ä¤ë¤«¤é¤Ê¡¢ÀäÂФˡª¡×");
1727 msg_print("You came out a winner! We'll win next time, I'm sure.");
1729 chg_virtue(V_CHANCE, 3);
1734 msg_print("¡Ö¶â¤ò¥¹¥Ã¤Æ¤·¤Þ¤Ã¤¿¤Ê¡¢¤ï¤Ï¤Ï¡ª¤¦¤Á¤Ëµ¢¤Ã¤¿Êý¤¬¤¤¤¤¤¼¡£¡×");
1736 msg_print("You lost gold! Haha, better head home.");
1738 chg_virtue(V_CHANCE, -3);
1748 * @brief ¥â¥ó¥¹¥¿¡¼Æ®µ»¾ì¤Ë»²²Ã¤Ç¤¤ë¥â¥ó¥¹¥¿¡¼¤ÎȽÄê
1749 * @param r_idx ¥â¥ó¥¹¥¿¡¼£É£Ä
1750 * @details ´ð½à¤ÏNEVER_MOVE MULTIPLY QUANTUM RF7_AQUATIC RF7_CHAMELEON¤Î¤¤¤º¤ì¤â»ý¤¿¤º¡¢
1751 * ¼«Çú°Ê³°¤Î¤Ê¤ó¤é¤«¤ÎHP¹¶·â¼êÃʤò»ý¤Ã¤Æ¤¤¤ë¤³¤È¡£
1752 * @return »²²Ã¤Ç¤¤ë¤«Èݤ«
1754 static bool vault_aux_battle(int r_idx)
1759 monster_race *r_ptr = &r_info[r_idx];
1761 /* Decline town monsters */
1762 /* if (!mon_hook_dungeon(r_idx)) return FALSE; */
1764 /* Decline unique monsters */
1765 /* if (r_ptr->flags1 & (RF1_UNIQUE)) return (FALSE); */
1766 /* if (r_ptr->flags7 & (RF7_NAZGUL)) return (FALSE); */
1768 if (r_ptr->flags1 & (RF1_NEVER_MOVE)) return (FALSE);
1769 if (r_ptr->flags2 & (RF2_MULTIPLY)) return (FALSE);
1770 if (r_ptr->flags2 & (RF2_QUANTUM)) return (FALSE);
1771 if (r_ptr->flags7 & (RF7_AQUATIC)) return (FALSE);
1772 if (r_ptr->flags7 & (RF7_CHAMELEON)) return (FALSE);
1774 for (i = 0; i < 4; i++)
1776 if (r_ptr->blow[i].method == RBM_EXPLODE) return (FALSE);
1777 if (r_ptr->blow[i].effect != RBE_DR_MANA) dam += r_ptr->blow[i].d_dice;
1779 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);
1786 * @brief ¥â¥ó¥¹¥¿¡¼Æ®µ»¾ì¤Ë»²²Ã¤¹¤ë¥â¥ó¥¹¥¿¡¼¤ò¥ê¥»¥Ã¥È¤¹¤ë¡£
1790 void battle_monsters(void)
1797 bool old_inside_battle = p_ptr->inside_battle;
1799 for (i = 0; i < max_d_idx; i++)
1800 if (max_dl < max_dlv[i]) max_dl = max_dlv[i];
1802 mon_level = randint1(MIN(max_dl, 122))+5;
1803 if (randint0(100) < 60)
1805 i = randint1(MIN(max_dl, 122))+5;
1806 mon_level = MAX(i, mon_level);
1808 if (randint0(100) < 30)
1810 i = randint1(MIN(max_dl, 122))+5;
1811 mon_level = MAX(i, mon_level);
1823 get_mon_num_prep(vault_aux_battle, NULL);
1824 p_ptr->inside_battle = TRUE;
1825 r_idx = get_mon_num(mon_level);
1826 p_ptr->inside_battle = old_inside_battle;
1827 if (!r_idx) continue;
1829 if ((r_info[r_idx].flags1 & RF1_UNIQUE) || (r_info[r_idx].flags7 & RF7_UNIQUE2))
1831 if ((r_info[r_idx].level + 10) > mon_level) continue;
1834 for (j = 0; j < i; j++)
1835 if(r_idx == battle_mon[j]) break;
1840 battle_mon[i] = r_idx;
1841 if (r_info[r_idx].level < 45) tekitou = TRUE;
1846 monster_race *r_ptr = &r_info[battle_mon[i]];
1847 int num_taisei = count_bits(r_ptr->flagsr & (RFR_IM_ACID | RFR_IM_ELEC | RFR_IM_FIRE | RFR_IM_COLD | RFR_IM_POIS));
1849 if (r_ptr->flags1 & RF1_FORCE_MAXHP)
1850 power[i] = r_ptr->hdice * r_ptr->hside * 2;
1852 power[i] = r_ptr->hdice * (r_ptr->hside + 1);
1853 power[i] = power[i] * (100 + r_ptr->level) / 100;
1854 if (r_ptr->speed > 110)
1855 power[i] = power[i] * (r_ptr->speed * 2 - 110) / 100;
1856 if (r_ptr->speed < 110)
1857 power[i] = power[i] * (r_ptr->speed - 20) / 100;
1859 power[i] = power[i] * (num_taisei*2+5) / 10;
1860 else if (r_ptr->flags6 & RF6_INVULNER)
1861 power[i] = power[i] * 4 / 3;
1862 else if (r_ptr->flags6 & RF6_HEAL)
1863 power[i] = power[i] * 4 / 3;
1864 else if (r_ptr->flags5 & RF5_DRAIN_MANA)
1865 power[i] = power[i] * 11 / 10;
1866 if (r_ptr->flags1 & RF1_RAND_25)
1867 power[i] = power[i] * 9 / 10;
1868 if (r_ptr->flags1 & RF1_RAND_50)
1869 power[i] = power[i] * 9 / 10;
1871 switch (battle_mon[i])
1882 case MON_UND_BEHOLDER:
1883 case MON_SANTACLAUS:
1884 case MON_ULT_BEHOLDER:
1886 case MON_ATLACH_NACHA:
1888 power[i] = power[i] * 3 / 5;
1890 case MON_ROBIN_HOOD:
1894 case MON_CRYPT_THING:
1895 case MON_MASTER_LICH:
1896 case MON_DREADMASTER:
1898 case MON_SHADOWLORD:
1903 case MON_VENOM_WYRM:
1904 case MON_MASTER_MYS:
1905 case MON_G_MASTER_MYS:
1906 power[i] = power[i] * 3 / 4;
1908 case MON_VORPAL_BUNNY:
1911 case MON_LOG_MASTER:
1913 case MON_GRAV_HOUND:
1916 case MON_CLUB_DEMON:
1918 case MON_NIGHTCRAWLER:
1919 case MON_NIGHTWALKER:
1925 case MON_SPECT_WYRM:
1930 power[i] = power[i] * 4 / 3;
1932 case MON_UMBER_HULK:
1936 case MON_ENERGY_VOR:
1940 case MON_PLASMA_VOR:
1945 case MON_STORMBRINGER:
1946 case MON_TIME_HOUND:
1947 case MON_PLASMA_HOUND:
1950 case MON_AETHER_VOR:
1951 case MON_AETHER_HOUND:
1959 case MON_D_ELF_SHADE:
1960 case MON_MANA_HOUND:
1962 case MON_BANORLUPART:
1967 power[i] = power[i] * 3 / 2;
1971 case MON_CYBER_KING:
1972 case MON_UNICORN_ORD:
1973 power[i] = power[i] * 5 / 3;
1977 case MON_WYRM_POWER:
1997 power[i] = total*60/power[i];
1998 if (tekitou && ((power[i] < 160) || power[i] > 1500)) break;
1999 if ((power[i] < 160) && randint0(20)) break;
2000 if (power[i] < 101) power[i] = 100 + randint1(5);
2001 mon_odds[i] = power[i];
2008 * @brief ¥â¥ó¥¹¥¿¡¼Æ®µ»¾ì¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó
2010 * @return ÅÒ¤±¤ò³«»Ï¤·¤¿¤«Èݤ«
2012 static bool kakutoujou(void)
2016 char out_val[160], tmp_str[80];
2019 if ((turn - old_battle) > TURNS_PER_TICK*250)
2031 msg_print("¤ª¤¤¡ª¤ª¤Þ¤¨°ìʸ¤Ê¤·¤¸¤ã¤Ê¤¤¤«¡ª¤³¤Ã¤«¤é½Ð¤Æ¤¤¤±¡ª");
2033 msg_print("Hey! You don't have gold - get out of here!");
2047 prt("¥â¥ó¥¹¥¿¡¼ ÇÜΨ", 4, 4);
2049 prt("Monsters Odds", 4, 4);
2054 monster_race *r_ptr = &r_info[battle_mon[i]];
2057 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);
2059 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);
2065 prt("¤É¤ì¤ËÅÒ¤±¤Þ¤¹¤«:", 0, 0);
2067 prt("Which monster: ", 0, 0);
2078 if (i >= '1' && i <= '4')
2080 sel_monster = i-'1';
2081 battle_odds = mon_odds[sel_monster];
2089 if (i !=sel_monster) clear_bldg(i+5,i+5);
2091 maxbet = p_ptr->lev * 200;
2093 /* We can't bet more than we have */
2094 maxbet = MIN(maxbet, p_ptr->au);
2097 strcpy(out_val, "");
2099 sprintf(tmp_str,"ÅÒ¤±¶â (1-%ld)¡©", (long int)maxbet);
2101 sprintf(tmp_str,"Your wager (1-%ld) ? ", (long int)maxbet);
2106 * Use get_string() because we may need more than
2107 * the s16b value returned by get_quantity().
2109 if (get_string(tmp_str, out_val, 32))
2112 for (p = out_val; *p == ' '; p++);
2117 if (wager > p_ptr->au)
2120 msg_print("¤ª¤¤¡ª¶â¤¬Â¤ê¤Ê¤¤¤¸¤ã¤Ê¤¤¤«¡ª½Ð¤Æ¤¤¤±¡ª");
2122 msg_print("Hey! You don't have the gold - get out of here!");
2129 else if (wager > maxbet)
2132 msg_format("%ld¥´¡¼¥ë¥É¤À¤±¼õ¤±¤è¤¦¡£»Ä¤ê¤Ï¼è¤Ã¤È¤¤Ê¡£", (long int)maxbet);
2134 msg_format("I'll take %ld gold of that. Keep the rest.",(long int) maxbet);
2142 msg_print("£Ï£Ë¡¢£±¥´¡¼¥ë¥É¤Ç¤¤¤³¤¦¡£");
2144 msg_print("Ok, we'll start with 1 gold.");
2151 battle_odds = MAX(wager+1, wager * battle_odds / 100);
2156 /* Save the surface floor as saved floor */
2157 prepare_change_floor_mode(CFM_SAVE_FLOORS);
2159 p_ptr->inside_battle = TRUE;
2160 p_ptr->leaving = TRUE;
2174 * @brief ËÜÆü¤Î¾Þ¶â¼ó¾ðÊó¤òɽ¼¨¤¹¤ë¡£
2178 static void today_target(void)
2181 monster_race *r_ptr = &r_info[today_mon];
2185 c_put_str(TERM_YELLOW, "ËÜÆü¤Î¾Þ¶â¼ó", 5, 10);
2187 prt("Wanted monster that changes from day to day", 5, 10);
2190 sprintf(buf,"¥¿¡¼¥²¥Ã¥È¡§ %s",r_name + r_ptr->name);
2192 sprintf(buf,"target: %s",r_name + r_ptr->name);
2194 c_put_str(TERM_YELLOW, buf, 6, 10);
2196 sprintf(buf,"»àÂÎ ---- $%d",r_ptr->level * 50 + 100);
2198 sprintf(buf,"corpse ---- $%d",r_ptr->level * 50 + 100);
2202 sprintf(buf,"¹ü ---- $%d",r_ptr->level * 30 + 60);
2204 sprintf(buf,"skeleton ---- $%d",r_ptr->level * 30 + 60);
2207 p_ptr->today_mon = today_mon;
2211 * @brief ¥Ä¥Á¥Î¥³¤Î¾Þ¶â¼ó¾ðÊó¤òɽ¼¨¤¹¤ë¡£
2215 static void tsuchinoko(void)
2219 c_put_str(TERM_YELLOW, "°ì³ÍÀé¶â¤ÎÂç¥Á¥ã¥ó¥¹¡ª¡ª¡ª", 5, 10);
2220 c_put_str(TERM_YELLOW, "¥¿¡¼¥²¥Ã¥È¡§¸¸¤ÎÄÁ½Ã¡Ö¥Ä¥Á¥Î¥³¡×", 6, 10);
2221 c_put_str(TERM_WHITE, "À¸¤±Êá¤ê ---- $1,000,000", 8, 10);
2222 c_put_str(TERM_WHITE, "»àÂÎ ---- $200,000", 9, 10);
2223 c_put_str(TERM_WHITE, "¹ü ---- $100,000", 10, 10);
2225 c_put_str(TERM_YELLOW, "Big chance to quick money!!!", 5, 10);
2226 c_put_str(TERM_YELLOW, "target: the rarest animal 'Tsuchinoko'", 6, 10);
2227 c_put_str(TERM_WHITE, "catch alive ---- $1,000,000", 8, 10);
2228 c_put_str(TERM_WHITE, "corpse ---- $200,000", 9, 10);
2229 c_put_str(TERM_WHITE, "bones ---- $100,000", 10, 10);
2234 * @brief Ä̾ï¤Î¾Þ¶â¼ó¾ðÊó¤òɽ¼¨¤¹¤ë¡£
2238 static void shoukinkubi(void)
2246 prt("»àÂΤò»ý¤Áµ¢¤ì¤ÐÊó½·¤òº¹¤·¾å¤²¤Þ¤¹¡£",4 ,10);
2247 c_put_str(TERM_YELLOW, "¸½ºß¤Î¾Þ¶â¼ó", 6, 10);
2249 prt("Offer a prize when you bring a wanted monster's corpse",4 ,10);
2250 c_put_str(TERM_YELLOW, "Wanted monsters", 6, 10);
2253 for (i = 0; i < MAX_KUBI; i++)
2257 monster_race *r_ptr = &r_info[(kubi_r_idx[i] > 10000 ? kubi_r_idx[i] - 10000 : kubi_r_idx[i])];
2259 if (kubi_r_idx[i] > 10000)
2265 done_mark = "(done)";
2274 c_prt(color, format("%s %s", r_name + r_ptr->name, done_mark), y+7, 10);
2277 if (!y && (i < MAX_KUBI -1))
2280 prt("²¿¤«¥¡¼¤ò²¡¤·¤Æ¤¯¤À¤µ¤¤", 0, 0);
2282 prt("Hit any key.", 0, 0);
2294 * ¾Þ¶â¼ó¤ÎÊ󽷥ơ¼¥Ö¥ë / List of prize object
2299 } prize_list[MAX_KUBI] =
2301 {TV_POTION, SV_POTION_CURING},
2302 {TV_POTION, SV_POTION_SPEED},
2303 {TV_POTION, SV_POTION_SPEED},
2304 {TV_POTION, SV_POTION_RESISTANCE},
2305 {TV_POTION, SV_POTION_ENLIGHTENMENT},
2307 {TV_POTION, SV_POTION_HEALING},
2308 {TV_POTION, SV_POTION_RESTORE_MANA},
2309 {TV_SCROLL, SV_SCROLL_STAR_DESTRUCTION},
2310 {TV_POTION, SV_POTION_STAR_ENLIGHTENMENT},
2311 {TV_SCROLL, SV_SCROLL_SUMMON_PET},
2313 {TV_SCROLL, SV_SCROLL_GENOCIDE},
2314 {TV_POTION, SV_POTION_STAR_HEALING},
2315 {TV_POTION, SV_POTION_STAR_HEALING},
2316 {TV_POTION, SV_POTION_NEW_LIFE},
2317 {TV_SCROLL, SV_SCROLL_MASS_GENOCIDE},
2319 {TV_POTION, SV_POTION_LIFE},
2320 {TV_POTION, SV_POTION_LIFE},
2321 {TV_POTION, SV_POTION_AUGMENTATION},
2322 {TV_POTION, SV_POTION_INVULNERABILITY},
2323 {TV_SCROLL, SV_SCROLL_ARTIFACT},
2327 * @brief ¾Þ¶â¼ó¤Î°ú¤´¹¤¨½èÍý / Get prize
2329 * @return ³Æ¼ï¾Þ¶â¼ó¤Î¤¤¤º¤ì¤«¤Ç¤â´¹¶â¤¬¹Ô¤ï¤ì¤¿¤«Èݤ«¡£
2331 static bool kankin(void)
2334 bool change = FALSE;
2335 char o_name[MAX_NLEN];
2338 /* Loop for inventory and right/left arm */
2339 for (i = 0; i <= INVEN_LARM; i++)
2341 o_ptr = &inventory[i];
2343 /* Living Tsuchinoko worthes $1000000 */
2344 if ((o_ptr->tval == TV_CAPTURE) && (o_ptr->pval == MON_TSUCHINOKO))
2346 char buf[MAX_NLEN+20];
2347 object_desc(o_name, o_ptr, 0);
2349 sprintf(buf, "%s ¤ò´¹¶â¤·¤Þ¤¹¤«¡©",o_name);
2351 sprintf(buf, "Convert %s into money? ",o_name);
2356 msg_format("¾Þ¶â %ld¡ð¤ò¼ê¤ËÆþ¤ì¤¿¡£", (long int)(1000000L * o_ptr->number));
2358 msg_format("You get %ldgp.", (long int)(1000000L * o_ptr->number));
2360 p_ptr->au += 1000000L * o_ptr->number;
2361 p_ptr->redraw |= (PR_GOLD);
2362 inven_item_increase(i, -o_ptr->number);
2363 inven_item_describe(i);
2364 inven_item_optimize(i);
2370 for (i = 0; i < INVEN_PACK; i++)
2372 o_ptr = &inventory[i];
2374 /* Corpse of Tsuchinoko worthes $200000 */
2375 if ((o_ptr->tval == TV_CORPSE) && (o_ptr->sval == SV_CORPSE) && (o_ptr->pval == MON_TSUCHINOKO))
2377 char buf[MAX_NLEN+20];
2378 object_desc(o_name, o_ptr, 0);
2380 sprintf(buf, "%s ¤ò´¹¶â¤·¤Þ¤¹¤«¡©",o_name);
2382 sprintf(buf, "Convert %s into money? ",o_name);
2387 msg_format("¾Þ¶â %ld¡ð¤ò¼ê¤ËÆþ¤ì¤¿¡£", (long int)(200000L * o_ptr->number));
2389 msg_format("You get %ldgp.", (long int)(200000L * o_ptr->number));
2391 p_ptr->au += 200000L * o_ptr->number;
2392 p_ptr->redraw |= (PR_GOLD);
2393 inven_item_increase(i, -o_ptr->number);
2394 inven_item_describe(i);
2395 inven_item_optimize(i);
2401 for (i = 0; i < INVEN_PACK; i++)
2403 o_ptr = &inventory[i];
2405 /* Bones of Tsuchinoko worthes $100000 */
2406 if ((o_ptr->tval == TV_CORPSE) && (o_ptr->sval == SV_SKELETON) && (o_ptr->pval == MON_TSUCHINOKO))
2408 char buf[MAX_NLEN+20];
2409 object_desc(o_name, o_ptr, 0);
2411 sprintf(buf, "%s ¤ò´¹¶â¤·¤Þ¤¹¤«¡©",o_name);
2413 sprintf(buf, "Convert %s into money? ",o_name);
2418 msg_format("¾Þ¶â %ld¡ð¤ò¼ê¤ËÆþ¤ì¤¿¡£", (long int)(100000L * o_ptr->number));
2420 msg_format("You get %ldgp.", (long int)(100000L * o_ptr->number));
2422 p_ptr->au += 100000L * o_ptr->number;
2423 p_ptr->redraw |= (PR_GOLD);
2424 inven_item_increase(i, -o_ptr->number);
2425 inven_item_describe(i);
2426 inven_item_optimize(i);
2432 for (i = 0; i < INVEN_PACK; i++)
2434 o_ptr = &inventory[i];
2435 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)))
2437 char buf[MAX_NLEN+20];
2438 object_desc(o_name, o_ptr, 0);
2440 sprintf(buf, "%s ¤ò´¹¶â¤·¤Þ¤¹¤«¡©",o_name);
2442 sprintf(buf, "Convert %s into money? ",o_name);
2447 msg_format("¾Þ¶â %ld¡ð¤ò¼ê¤ËÆþ¤ì¤¿¡£", (long int)((r_info[today_mon].level * 50 + 100) * o_ptr->number));
2449 msg_format("You get %ldgp.", (long int)((r_info[today_mon].level * 50 + 100) * o_ptr->number));
2451 p_ptr->au += (r_info[today_mon].level * 50 + 100) * o_ptr->number;
2452 p_ptr->redraw |= (PR_GOLD);
2453 inven_item_increase(i, -o_ptr->number);
2454 inven_item_describe(i);
2455 inven_item_optimize(i);
2461 for (i = 0; i < INVEN_PACK; i++)
2463 o_ptr = &inventory[i];
2465 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)))
2467 char buf[MAX_NLEN+20];
2468 object_desc(o_name, o_ptr, 0);
2470 sprintf(buf, "%s ¤ò´¹¶â¤·¤Þ¤¹¤«¡©",o_name);
2472 sprintf(buf, "Convert %s into money? ",o_name);
2477 msg_format("¾Þ¶â %ld¡ð¤ò¼ê¤ËÆþ¤ì¤¿¡£", (long int)((r_info[today_mon].level * 30 + 60) * o_ptr->number));
2479 msg_format("You get %ldgp.", (long int)((r_info[today_mon].level * 30 + 60) * o_ptr->number));
2481 p_ptr->au += (r_info[today_mon].level * 30 + 60) * o_ptr->number;
2482 p_ptr->redraw |= (PR_GOLD);
2483 inven_item_increase(i, -o_ptr->number);
2484 inven_item_describe(i);
2485 inven_item_optimize(i);
2491 for (j = 0; j < MAX_KUBI; j++)
2493 /* Need reverse order --- Positions will be changed in the loop */
2494 for (i = INVEN_PACK-1; i >= 0; i--)
2496 o_ptr = &inventory[i];
2497 if ((o_ptr->tval == TV_CORPSE) && (o_ptr->pval == kubi_r_idx[j]))
2499 char buf[MAX_NLEN+20];
2500 int num, k, item_new;
2503 object_desc(o_name, o_ptr, 0);
2505 sprintf(buf, "%s¤òÅϤ·¤Þ¤¹¤«¡©",o_name);
2507 sprintf(buf, "Hand %s over? ",o_name);
2509 if (!get_check(buf)) continue;
2511 #if 0 /* Obsoleted */
2513 msg_format("¾Þ¶â %ld¡ð¤ò¼ê¤ËÆþ¤ì¤¿¡£", (r_info[kubi_r_idx[j]].level + 1) * 300 * o_ptr->number);
2515 msg_format("You get %ldgp.", (r_info[kubi_r_idx[j]].level + 1) * 300 * o_ptr->number);
2517 p_ptr->au += (r_info[kubi_r_idx[j]].level+1) * 300 * o_ptr->number;
2518 p_ptr->redraw |= (PR_GOLD);
2519 inven_item_increase(i, -o_ptr->number);
2520 inven_item_describe(i);
2521 inven_item_optimize(i);
2522 chg_virtue(V_JUSTICE, 5);
2523 kubi_r_idx[j] += 10000;
2526 #endif /* Obsoleted */
2529 inven_item_increase(i, -o_ptr->number);
2530 inven_item_describe(i);
2531 inven_item_optimize(i);
2533 chg_virtue(V_JUSTICE, 5);
2534 kubi_r_idx[j] += 10000;
2536 /* Count number of unique corpses already handed */
2537 for (num = 0, k = 0; k < MAX_KUBI; k++)
2539 if (kubi_r_idx[k] >= 10000) num++;
2543 msg_format("¤³¤ì¤Ç¹ç·× %d ¥Ý¥¤¥ó¥È³ÍÆÀ¤·¤Þ¤·¤¿¡£", num);
2545 msg_format("You earned %d point%s total.", num, (num > 1 ? "s" : ""));
2548 /* Prepare to make a prize */
2549 object_prep(&forge, lookup_kind(prize_list[num-1].tval, prize_list[num-1].sval));
2550 apply_magic(&forge, object_level, AM_NO_FIXED_ART);
2552 /* Identify it fully */
2553 object_aware(&forge);
2554 object_known(&forge);
2557 * Hand it --- Assume there is an empty slot.
2558 * Since a corpse is handed at first,
2559 * there is at least one empty slot.
2561 item_new = inven_carry(&forge);
2563 /* Describe the object */
2564 object_desc(o_name, &forge, 0);
2566 msg_format("%s(%c)¤òÌã¤Ã¤¿¡£", o_name, index_to_label(item_new));
2568 msg_format("You get %s (%c). ", o_name, index_to_label(item_new));
2571 /* Auto-inscription */
2572 autopick_alter_item(item_new, FALSE);
2585 msg_print("¾Þ¶â¤òÆÀ¤é¤ì¤½¤¦¤Ê¤â¤Î¤Ï»ý¤Ã¤Æ¤¤¤Ê¤«¤Ã¤¿¡£");
2587 msg_print("You have nothing.");
2595 bool get_nightmare(int r_idx)
2597 monster_race *r_ptr = &r_info[r_idx];
2599 /* Require eldritch horrors */
2600 if (!(r_ptr->flags2 & (RF2_ELDRITCH_HORROR))) return (FALSE);
2602 /* Require high level */
2603 if (r_ptr->level <= p_ptr->lev) return (FALSE);
2605 /* Accept this monster */
2610 * @brief °Ì´¥â¡¼¥É»þ¤Ë¿ç̲/Ëãáã¤Ë´Ù¤Ã¤¿ºÝ¤ÎEldritchHorror½èÍý
2611 * @param r_idx ¶¸µ¤¤Î¸µ¶§¤È¤Ê¤ë¥â¥ó¥¹¥¿¡¼¤Î£É£Ä
2613 * @todo ½ÅÊ£´Ø¿ô¤¢¤ê¡¢Í×¥ê¥Õ¥¡¥¯¥¿¥ê¥ó¥°¡£
2615 void have_nightmare(int r_idx)
2617 bool happened = FALSE;
2618 monster_race *r_ptr = &r_info[r_idx];
2619 int power = r_ptr->level + 10;
2621 cptr desc = r_name + r_ptr->name;
2625 if (!(r_ptr->flags1 & RF1_UNIQUE))
2626 sprintf(m_name, "%s %s", (is_a_vowel(desc[0]) ? "an" : "a"), desc);
2629 sprintf(m_name, "%s", desc);
2631 if (!(r_ptr->flags1 & RF1_UNIQUE))
2633 if (r_ptr->flags1 & RF1_FRIENDS) power /= 2;
2637 if (saving_throw(p_ptr->skill_sav * 100 / power))
2640 msg_format("Ì´¤ÎÃæ¤Ç%s¤ËÄɤ¤¤«¤±¤é¤ì¤¿¡£", m_name);
2642 msg_format("%^s chases you through your dreams.", m_name);
2651 /* Something silly happens... */
2653 msg_format("%s%s¤Î´é¤ò¸«¤Æ¤·¤Þ¤Ã¤¿¡ª",
2655 msg_format("You behold the %s visage of %s!",
2658 funny_desc[randint0(MAX_SAN_FUNNY)], m_name);
2662 msg_print(funny_comments[randint0(MAX_SAN_COMMENT)]);
2663 p_ptr->image = p_ptr->image + randint1(r_ptr->level);
2666 /* Never mind; we can't see it clearly enough */
2670 /* Something frightening happens... */
2672 msg_format("%s%s¤Î´é¤ò¸«¤Æ¤·¤Þ¤Ã¤¿¡ª",
2674 msg_format("You behold the %s visage of %s!",
2677 horror_desc[randint0(MAX_SAN_HORROR)], desc);
2679 r_ptr->r_flags2 |= RF2_ELDRITCH_HORROR;
2681 if (!p_ptr->mimic_form)
2683 switch (p_ptr->prace)
2685 /* Demons may make a saving throw */
2688 if (saving_throw(20 + p_ptr->lev)) return;
2690 /* Undead may make a saving throw */
2695 if (saving_throw(10 + p_ptr->lev)) return;
2701 /* Demons may make a saving throw */
2702 if (mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_DEMON)
2704 if (saving_throw(20 + p_ptr->lev)) return;
2706 /* Undead may make a saving throw */
2707 else if (mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_UNDEAD)
2709 if (saving_throw(10 + p_ptr->lev)) return;
2714 if (!saving_throw(p_ptr->skill_sav * 100 / power))
2716 if (!p_ptr->resist_conf)
2718 (void)set_confused(p_ptr->confused + randint0(4) + 4);
2720 if (!p_ptr->resist_chaos && one_in_(3))
2722 (void)set_image(p_ptr->image + randint0(250) + 150);
2727 /* Lose int & wis */
2728 if (!saving_throw(p_ptr->skill_sav * 100 / power))
2736 if (!saving_throw(p_ptr->skill_sav * 100 / power))
2738 if (!p_ptr->resist_conf)
2740 (void)set_confused(p_ptr->confused + randint0(4) + 4);
2742 if (!p_ptr->free_act)
2744 (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
2746 while (!saving_throw(p_ptr->skill_sav))
2748 (void)do_dec_stat(A_INT);
2750 while (!saving_throw(p_ptr->skill_sav))
2752 (void)do_dec_stat(A_WIS);
2754 if (!p_ptr->resist_chaos)
2756 (void)set_image(p_ptr->image + randint0(250) + 150);
2763 if (!saving_throw(p_ptr->skill_sav * 100 / power))
2765 if (lose_all_info())
2768 msg_print("¤¢¤Þ¤ê¤Î¶²ÉݤËÁ´¤Æ¤Î¤³¤È¤ò˺¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª");
2770 msg_print("You forget everything in your utmost terror!");
2777 /* Else gain permanent insanity */
2778 if ((p_ptr->muta3 & MUT3_MORONIC) && (p_ptr->muta2 & MUT2_BERS_RAGE) &&
2779 ((p_ptr->muta2 & MUT2_COWARDICE) || (p_ptr->resist_fear)) &&
2780 ((p_ptr->muta2 & MUT2_HALLU) || (p_ptr->resist_chaos)))
2782 /* The poor bastard already has all possible insanities! */
2788 switch (randint1(4))
2792 if (!(p_ptr->muta3 & MUT3_MORONIC))
2794 if ((p_ptr->stat_use[A_INT] < 4) && (p_ptr->stat_use[A_WIS] < 4))
2797 msg_print("¤¢¤Ê¤¿¤Ï´°àú¤ÊÇϼ¯¤Ë¤Ê¤Ã¤¿¤è¤¦¤Êµ¤¤¬¤·¤¿¡£¤·¤«¤·¤½¤ì¤Ï¸µ¡¹¤À¤Ã¤¿¡£");
2799 msg_print("You turn into an utter moron!");
2805 msg_print("¤¢¤Ê¤¿¤Ï´°àú¤ÊÇϼ¯¤Ë¤Ê¤Ã¤¿¡ª");
2807 msg_print("You turn into an utter moron!");
2811 if (p_ptr->muta3 & MUT3_HYPER_INT)
2814 msg_print("¤¢¤Ê¤¿¤ÎǾ¤ÏÀ¸ÂÎ¥³¥ó¥Ô¥å¡¼¥¿¤Ç¤Ï¤Ê¤¯¤Ê¤Ã¤¿¡£");
2816 msg_print("Your brain is no longer a living computer.");
2819 p_ptr->muta3 &= ~(MUT3_HYPER_INT);
2821 p_ptr->muta3 |= MUT3_MORONIC;
2828 if (!(p_ptr->muta2 & MUT2_COWARDICE) && !p_ptr->resist_fear)
2831 msg_print("¤¢¤Ê¤¿¤Ï¥Ñ¥é¥Î¥¤¥¢¤Ë¤Ê¤Ã¤¿¡ª");
2833 msg_print("You become paranoid!");
2837 /* Duh, the following should never happen, but anyway... */
2838 if (p_ptr->muta3 & MUT3_FEARLESS)
2841 msg_print("¤¢¤Ê¤¿¤Ï¤â¤¦¶²¤ìÃΤ餺¤Ç¤Ï¤Ê¤¯¤Ê¤Ã¤¿¡£");
2843 msg_print("You are no longer fearless.");
2846 p_ptr->muta3 &= ~(MUT3_FEARLESS);
2849 p_ptr->muta2 |= MUT2_COWARDICE;
2856 if (!(p_ptr->muta2 & MUT2_HALLU) && !p_ptr->resist_chaos)
2859 msg_print("¸¸³Ð¤ò¤Ò¤µ¯¤³¤¹Àº¿ÀºøÍð¤Ë´Ù¤Ã¤¿¡ª");
2861 msg_print("You are afflicted by a hallucinatory insanity!");
2864 p_ptr->muta2 |= MUT2_HALLU;
2871 if (!(p_ptr->muta2 & MUT2_BERS_RAGE))
2874 msg_print("·ãÎõ¤Ê´¶¾ð¤Îȯºî¤Ë¤ª¤½¤ï¤ì¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¡ª");
2876 msg_print("You become subject to fits of berserk rage!");
2879 p_ptr->muta2 |= MUT2_BERS_RAGE;
2887 p_ptr->update |= PU_BONUS;
2893 * @brief ½É²°¤ÎÍøÍÑ¥µ¥Ö¥ë¡¼¥Á¥ó
2894 * @details inn commands\n
2895 * Note that resting for the night was a perfect way to avoid player\n
2896 * ghosts in the town *if* you could only make it to the inn in time (-:\n
2897 * Now that the ghosts are temporarily disabled in 2.8.X, this function\n
2898 * will not be that useful. I will keep it in the hopes the player\n
2899 * ghost code does become a reality again. Does help to avoid filthy urchins.\n
2900 * Resting at night is also a quick way to restock stores -KMW-\n
2901 * @param cmd ½É²°¤ÎÍøÍÑ»ÜÀßID
2902 * @return »ÜÀߤÎÍøÍѤ¬¼ÂºÝ¤Ë¹Ô¤ï¤ì¤¿¤«Èݤ«¡£
2904 static bool inn_comm(int cmd)
2908 case BACT_FOOD: /* Buy food & drink */
2909 if (p_ptr->food >= PY_FOOD_FULL)
2912 msg_print("º£¤ÏËþÊ¢¤À¡£");
2914 msg_print("You are full now.");
2920 msg_print("¥Ð¡¼¥Æ¥ó¤Ï¤¤¤¯¤é¤«¤Î¿©¤Ùʪ¤È¥Ó¡¼¥ë¤ò¤¯¤ì¤¿¡£");
2922 msg_print("The barkeep gives you some gruel and a beer.");
2925 (void)set_food(PY_FOOD_MAX - 1);
2928 case BACT_REST: /* Rest for the night */
2929 if ((p_ptr->poisoned) || (p_ptr->cut))
2932 msg_print("¤¢¤Ê¤¿¤ËɬÍפʤΤÏÉô²°¤Ç¤Ï¤Ê¤¯¡¢¼£ÎżԤǤ¹¡£");
2934 msg_print("You need a healer, not a room.");
2939 msg_print("¤¹¤ß¤Þ¤»¤ó¡¢¤Ç¤â¤¦¤Á¤Ç狼¤Ë»à¤Ê¤ì¤Á¤ãº¤¤ê¤Þ¤¹¤ó¤Ç¡£");
2941 msg_print("Sorry, but don't want anyone dying in here.");
2946 s32b oldturn = turn;
2947 int prev_day, prev_hour, prev_min;
2949 extract_day_hour_min(&prev_day, &prev_hour, &prev_min);
2951 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "½É²°¤ËÇñ¤Þ¤Ã¤¿¡£");
2953 if ((prev_hour >= 6) && (prev_hour <= 17)) do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "stay over daytime at the inn.");
2954 else do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "stay over night at the inn.");
2956 turn = (turn / (TURNS_PER_TICK*TOWN_DAWN/2) + 1) * (TURNS_PER_TICK*TOWN_DAWN/2);
2957 if (dungeon_turn < dungeon_turn_limit)
2959 dungeon_turn += MIN(turn - oldturn, TURNS_PER_TICK * 250);
2960 if (dungeon_turn > dungeon_turn_limit) dungeon_turn = dungeon_turn_limit;
2963 prevent_turn_overflow();
2965 if ((prev_hour >= 18) && (prev_hour <= 23)) do_cmd_write_nikki(NIKKI_HIGAWARI, 0, NULL);
2966 p_ptr->chp = p_ptr->mhp;
2968 if (ironman_nightmare)
2971 msg_print("̲¤ê¤Ë½¢¤¯¤È¶²¤í¤·¤¤¸÷·Ê¤¬¿´¤ò¤è¤®¤Ã¤¿¡£");
2973 msg_print("Horrible visions flit through your mind as you sleep.");
2976 /* Pick a nightmare */
2977 get_mon_num_prep(get_nightmare, NULL);
2979 /* Have some nightmares */
2982 have_nightmare(get_mon_num(MAX_DEPTH));
2984 if (!one_in_(3)) break;
2987 /* Remove the monster restriction */
2988 get_mon_num_prep(NULL, NULL);
2991 msg_print("¤¢¤Ê¤¿¤ÏÀ䶫¤·¤ÆÌܤò³Ð¤Þ¤·¤¿¡£");
2992 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "°Ì´¤Ë¤¦¤Ê¤µ¤ì¤Æ¤è¤¯Ì²¤ì¤Ê¤«¤Ã¤¿¡£");
2994 msg_print("You awake screaming.");
2995 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "be troubled by a nightmare.");
3003 p_ptr->chp = p_ptr->mhp;
3004 p_ptr->csp = p_ptr->msp;
3005 if (p_ptr->pclass == CLASS_MAGIC_EATER)
3008 for (i = 0; i < 72; i++)
3010 p_ptr->magic_num1[i] = p_ptr->magic_num2[i]*EATER_CHARGE;
3012 for (; i < 108; i++)
3014 p_ptr->magic_num1[i] = 0;
3018 if ((prev_hour >= 6) && (prev_hour <= 17))
3021 msg_print("¤¢¤Ê¤¿¤Ï¥ê¥Õ¥ì¥Ã¥·¥å¤·¤ÆÌܳФᡢͼÊý¤ò·Þ¤¨¤¿¡£");
3022 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "ͼÊý¤ò·Þ¤¨¤¿¡£");
3024 msg_print("You awake refreshed for the evening.");
3025 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "awake refreshed.");
3031 msg_print("¤¢¤Ê¤¿¤Ï¥ê¥Õ¥ì¥Ã¥·¥å¤·¤ÆÌܳФᡢ¿·¤¿¤ÊÆü¤ò·Þ¤¨¤¿¡£");
3032 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "¤¹¤¬¤¹¤¬¤·¤¤Ä«¤ò·Þ¤¨¤¿¡£");
3034 msg_print("You awake refreshed for the new day.");
3035 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "awake refreshed.");
3042 case BACT_RUMORS: /* Listen for rumors */
3044 display_rumor(TRUE);
3054 * Display quest information
3056 static void get_questinfo(int questnum, bool do_init)
3063 /* Clear the text */
3064 for (i = 0; i < 10; i++)
3066 quest_text[i][0] = '\0';
3069 quest_text_line = 0;
3071 /* Set the quest number temporary */
3072 old_quest = p_ptr->inside_quest;
3073 p_ptr->inside_quest = questnum;
3075 /* Get the quest text */
3076 init_flags = INIT_SHOW_TEXT;
3077 if (do_init) init_flags |= INIT_ASSIGN;
3079 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
3081 /* Reset the old quest number */
3082 p_ptr->inside_quest = old_quest;
3084 /* Print the quest info */
3086 sprintf(tmp_str, "¥¯¥¨¥¹¥È¾ðÊó (´í¸±ÅÙ: %d ³¬ÁêÅö)", quest[questnum].level);
3088 sprintf(tmp_str, "Quest Information (Danger level: %d)", quest[questnum].level);
3093 prt(quest[questnum].name, 7, 0);
3095 for (i = 0; i < 10; i++)
3097 c_put_str(TERM_YELLOW, quest_text[i], i + 8, 0);
3103 * Request a quest from the Lord.
3105 static void castle_quest(void)
3108 monster_race *r_ptr;
3115 /* Current quest of the building */
3116 q_index = cave[py][px].special;
3118 /* Is there a quest available at the building? */
3122 put_str("º£¤Î¤È¤³¤í¥¯¥¨¥¹¥È¤Ï¤¢¤ê¤Þ¤»¤ó¡£", 8, 0);
3124 put_str("I don't have a quest for you at the moment.", 8, 0);
3130 q_ptr = &quest[q_index];
3132 /* Quest is completed */
3133 if (q_ptr->status == QUEST_STATUS_COMPLETED)
3135 /* Rewarded quest */
3136 q_ptr->status = QUEST_STATUS_REWARDED;
3138 get_questinfo(q_index, FALSE);
3140 reinit_wilderness = TRUE;
3143 else if (q_ptr->status == QUEST_STATUS_FAILED)
3145 get_questinfo(q_index, FALSE);
3147 /* Mark quest as done (but failed) */
3148 q_ptr->status = QUEST_STATUS_FAILED_DONE;
3150 reinit_wilderness = TRUE;
3152 /* Quest is still unfinished */
3153 else if (q_ptr->status == QUEST_STATUS_TAKEN)
3156 put_str("¤¢¤Ê¤¿¤Ï¸½ºß¤Î¥¯¥¨¥¹¥È¤ò½ªÎ»¤µ¤»¤Æ¤¤¤Þ¤»¤ó¡ª", 8, 0);
3158 put_str("You have not completed your current quest yet!", 8, 0);
3162 put_str("CTRL-Q¤ò»È¤¨¤Ð¥¯¥¨¥¹¥È¤Î¾õÂÖ¤¬¥Á¥§¥Ã¥¯¤Ç¤¤Þ¤¹¡£", 9, 0);
3164 put_str("Use CTRL-Q to check the status of your quest.", 9, 0);
3168 put_str("¥¯¥¨¥¹¥È¤ò½ª¤ï¤é¤»¤¿¤éÌá¤Ã¤ÆÍè¤Æ²¼¤µ¤¤¡£", 12, 0);
3170 put_str("Return when you have completed your quest.", 12, 0);
3175 else if (q_ptr->status == QUEST_STATUS_UNTAKEN)
3177 q_ptr->status = QUEST_STATUS_TAKEN;
3179 reinit_wilderness = TRUE;
3181 /* Assign a new quest */
3182 if (q_ptr->type == QUEST_TYPE_KILL_ANY_LEVEL)
3184 if (q_ptr->r_idx == 0)
3186 /* Random monster at least 5 - 10 levels out of deep */
3187 q_ptr->r_idx = get_mon_num(q_ptr->level + 4 + randint1(6));
3190 r_ptr = &r_info[q_ptr->r_idx];
3192 while ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->rarity != 1))
3194 q_ptr->r_idx = get_mon_num(q_ptr->level) + 4 + randint1(6);
3195 r_ptr = &r_info[q_ptr->r_idx];
3198 if (q_ptr->max_num == 0)
3200 /* Random monster number */
3201 if (randint1(10) > 7)
3204 q_ptr->max_num = randint1(3) + 1;
3208 name = (r_name + r_ptr->name);
3210 msg_format("¥¯¥¨¥¹¥È: %s¤ò %dÂÎÅݤ¹", name,q_ptr->max_num);
3212 msg_format("Your quest: kill %d %s", q_ptr->max_num, name);
3218 get_questinfo(q_index, TRUE);
3225 * Display town history
3227 static void town_history(void)
3232 /* Peruse the building help file */
3234 (void)show_file(TRUE, "jbldg.txt", NULL, 0, 0);
3236 (void)show_file(TRUE, "bldg.txt", NULL, 0, 0);
3244 /* critical happens at i / 10000 */
3245 s16b calc_crit_ratio_shot(int weight, int plus_ammo, int plus_bow, int dam)
3248 object_type *j_ptr = &inventory[INVEN_BOW];
3250 /* Extract "shot" power */
3251 i = p_ptr->to_h_b + plus_ammo;
3253 if (p_ptr->tval_ammo == TV_BOLT)
3254 i = (p_ptr->skill_thb + (p_ptr->weapon_exp[0][j_ptr->sval] / 400 + i) * BTH_PLUS_ADJ);
3256 i = (p_ptr->skill_thb + ((p_ptr->weapon_exp[0][j_ptr->sval] - (WEAPON_EXP_MASTER / 2)) / 200 + i) * BTH_PLUS_ADJ);
3258 /* Snipers can shot more critically with crossbows */
3259 if (p_ptr->concent) i += ((i * p_ptr->concent) / 5);
3260 if ((p_ptr->pclass == CLASS_SNIPER) && (p_ptr->tval_ammo == TV_BOLT)) i *= 2;
3262 /* Good bow makes more critical */
3263 i += plus_bow * 8 * (p_ptr->concent ? p_ptr->concent + 5 : 5);
3270 s16b calc_expect_crit_shot(int weight, int plus_ammo, int plus_bow, int dam)
3274 i = calc_crit_ratio_shot(weight, plus_ammo, plus_bow, dam);
3279 crit = MIN(500, 900/weight);
3280 num += dam * 3 /2 * crit;
3283 crit = MIN(500, 1350/weight);
3285 num += dam * 2 * crit;
3291 num += dam * 3 * crit;
3297 num += (10000 - i) * dam;
3303 s16b calc_expect_crit(int weight, int plus, int dam, s16b meichuu, bool dokubari)
3308 if(dokubari) return dam;
3310 i = (weight + (meichuu * 3 + plus * 5) + p_ptr->skill_thn);
3316 if (k < 400) num += (2 * dam + 5) * (400 - k);
3317 if (k < 700) num += (2 * dam + 10) * (MIN(700, k + 650) - MAX(400, k));
3318 if (k > (700 - 650) && k < 900) num += (3 * dam + 15) * (MIN(900, k + 650) - MAX(700, k));
3319 if (k > (900 - 650) && k < 1300) num += (3 * dam + 20) * (MIN(1300, k + 650) - MAX(900, k));
3320 if (k > (1300 - 650)) num += (7 * dam / 2 + 25) * MIN(650, k - (1300 - 650));
3323 if(p_ptr->pclass == CLASS_NINJA)
3326 num += (4444 - i) * dam;
3332 num += (5000 - i) * dam;
3339 static s16b calc_slaydam(int dam, int mult, int div, bool force)
3347 tmp += dam * 60 * 2;
3360 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)
3362 dam = calc_slaydam(dam, mult, div, force);
3363 dam = calc_expect_crit(weight, plus, dam, meichuu, dokubari);
3364 dam = calc_slaydam(dam, vorpal_mult, vorpal_div, FALSE);
3369 * Display the damage figure of an object
3370 * (used by compare_weapon_aux)
3372 * Only accurate for the current weapon, because it includes
3373 * the current +dam of the player.
3375 static void show_weapon_dmg(int r, int c, int mindice, int maxdice, int blows, int dam_bonus, cptr attr, byte color)
3380 mindam = blows * (mindice + dam_bonus);
3381 maxdam = blows * (maxdice + dam_bonus);
3383 /* Print the intro text */
3384 c_put_str(color, attr, r, c);
3386 /* Calculate the min and max damage figures */
3388 sprintf(tmp_str, "£±¥¿¡¼¥ó: %d-%d ¥À¥á¡¼¥¸",
3390 sprintf(tmp_str, "Attack: %d-%d damage",
3394 /* Print the damage */
3395 put_str(tmp_str, r, c + 8);
3400 * Show the damage figures for the various monster types
3402 * Only accurate for the current weapon, because it includes
3403 * the current number of blows for the player.
3405 static void compare_weapon_aux(object_type *o_ptr, int col, int r)
3407 u32b flgs[TR_FLAG_SIZE];
3408 int blow = p_ptr->num_blow[0];
3410 bool dokubari = FALSE;
3412 /* Effective dices */
3413 int eff_dd = o_ptr->dd + p_ptr->to_dd[0];
3414 int eff_ds = o_ptr->ds + p_ptr->to_ds[0];
3416 int mindice = eff_dd;
3417 int maxdice = eff_ds * eff_dd;
3420 int vorpal_mult = 1;
3422 int dmg_bonus = o_ptr->to_d + p_ptr->to_d[0];
3425 /* Get the flags of the weapon */
3426 object_flags(o_ptr, flgs);
3428 if((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) dokubari = TRUE;
3431 /* Show Critical Damage*/
3432 mindam = calc_expect_crit(o_ptr->weight, o_ptr->to_h, mindice, p_ptr->to_h[0], dokubari);
3433 maxdam = calc_expect_crit(o_ptr->weight, o_ptr->to_h, maxdice, p_ptr->to_h[0], dokubari);
3435 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("²ñ¿´:", "Critical:"), TERM_L_RED);
3439 if ((have_flag(flgs, TR_VORPAL) || hex_spelling(HEX_RUNESWORD)))
3441 if((o_ptr->name1 == ART_VORPAL_BLADE) || (o_ptr->name1 == ART_CHAINSWORD))
3452 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);
3453 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);
3454 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("ÀÚ¤ìÌ£:", "Vorpal:") , TERM_L_RED);
3457 if ((p_ptr->pclass != CLASS_SAMURAI) && have_flag(flgs, TR_FORCE_WEAPON) && (p_ptr->csp > (o_ptr->dd * o_ptr->ds / 5)))
3461 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);
3462 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);
3463 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("ÍýÎÏ:", "Force :"), TERM_L_BLUE);
3466 /* Print the relevant lines */
3467 if (have_flag(flgs, TR_KILL_ANIMAL))
3469 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);
3470 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);
3471 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("ưʪ:", "Animals:"), TERM_YELLOW);
3473 else if (have_flag(flgs, TR_SLAY_ANIMAL))
3475 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);
3476 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);
3477 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("ưʪ:", "Animals:"), TERM_YELLOW);
3479 if (have_flag(flgs, TR_KILL_EVIL))
3481 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);
3482 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);
3483 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("¼Ù°:", "Evil:"), TERM_YELLOW);
3485 else if (have_flag(flgs, TR_SLAY_EVIL))
3487 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);
3488 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);
3489 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("¼Ù°:", "Evil:"), TERM_YELLOW);
3491 if (have_flag(flgs, TR_KILL_HUMAN))
3493 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);
3494 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);
3495 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("¿Í´Ö:", "Human:"), TERM_YELLOW);
3497 else if (have_flag(flgs, TR_SLAY_HUMAN))
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, _("¿Í´Ö:", "Human:"), TERM_YELLOW);
3503 if (have_flag(flgs, TR_KILL_UNDEAD))
3505 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);
3506 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);
3507 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("ÉÔ»à:", "Undead:"), TERM_YELLOW);
3509 else if (have_flag(flgs, TR_SLAY_UNDEAD))
3511 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);
3512 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);
3513 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("ÉÔ»à:", "Undead:"), TERM_YELLOW);
3515 if (have_flag(flgs, TR_KILL_DEMON))
3517 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);
3518 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);
3519 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("°Ëâ:", "Demons:") , TERM_YELLOW);
3521 else if (have_flag(flgs, TR_SLAY_DEMON))
3523 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);
3524 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);
3525 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("°Ëâ:", "Demons:") , TERM_YELLOW);
3527 if (have_flag(flgs, TR_KILL_ORC))
3529 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);
3530 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);
3531 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("¥ª¡¼¥¯:", "Orcs:"), TERM_YELLOW);
3533 else if (have_flag(flgs, TR_SLAY_ORC))
3535 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);
3536 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);
3537 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("¥ª¡¼¥¯:", "Orcs:"), TERM_YELLOW);
3539 if (have_flag(flgs, TR_KILL_TROLL))
3541 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);
3542 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);
3543 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("¥È¥í¥ë:", "Trolls:") , TERM_YELLOW);
3545 else if (have_flag(flgs, TR_SLAY_TROLL))
3547 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);
3548 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);
3549 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("¥È¥í¥ë:", "Trolls:") , TERM_YELLOW);
3551 if (have_flag(flgs, TR_KILL_GIANT))
3553 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);
3554 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);
3555 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("µð¿Í:", "Giants:"), TERM_YELLOW);
3557 else if (have_flag(flgs, TR_SLAY_GIANT))
3559 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);
3560 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);
3561 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("µð¿Í:", "Giants:"), TERM_YELLOW);
3563 if (have_flag(flgs, TR_KILL_DRAGON))
3565 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);
3566 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);
3567 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("ε:", "Dragons:"), TERM_YELLOW);
3569 else if (have_flag(flgs, TR_SLAY_DRAGON))
3571 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);
3572 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);
3573 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("ε:", "Dragons:"), TERM_YELLOW);
3575 if (have_flag(flgs, TR_BRAND_ACID))
3577 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);
3578 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);
3579 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("»À°À:", "Acid:"), TERM_RED);
3581 if (have_flag(flgs, TR_BRAND_ELEC))
3583 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);
3584 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);
3585 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("ÅÅ°À:", "Elec:"), TERM_RED);
3587 if (have_flag(flgs, TR_BRAND_FIRE))
3589 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);
3590 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);
3591 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("±ê°À:", "Fire:"), TERM_RED);
3593 if (have_flag(flgs, TR_BRAND_COLD))
3595 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);
3596 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);
3597 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("Îä°À:", "Cold:"), TERM_RED);
3599 if (have_flag(flgs, TR_BRAND_POIS))
3601 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);
3602 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);
3603 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("ÆÇ°À:", "Poison:"), TERM_RED);
3607 static int hit_chance(int to_h, int ac)
3610 int meichuu = p_ptr->skill_thn + (p_ptr->to_h[0] + to_h) * BTH_PLUS_ADJ;
3612 if (meichuu <= 0) return 5;
3614 chance = 100 - ((ac * 75) / meichuu);
3616 if (chance > 95) chance = 95;
3617 if (chance < 5) chance = 5;
3618 if (p_ptr->pseikaku == SEIKAKU_NAMAKE)
3619 chance = (chance*19+9)/20;
3624 * Displays all info about a weapon
3626 * Only accurate for the current weapon, because it includes
3627 * various info about the player's +to_dam and number of blows.
3629 static void list_weapon(object_type *o_ptr, int row, int col)
3631 char o_name[MAX_NLEN];
3634 /* Effective dices */
3635 int eff_dd = o_ptr->dd + p_ptr->to_dd[0];
3636 int eff_ds = o_ptr->ds + p_ptr->to_ds[0];
3638 /* Print the weapon name */
3639 object_desc(o_name, o_ptr, OD_NAME_ONLY);
3640 c_put_str(TERM_YELLOW, o_name, row, col);
3642 /* Print the player's number of blows */
3644 sprintf(tmp_str, "¹¶·â²ó¿ô: %d", p_ptr->num_blow[0]);
3646 sprintf(tmp_str, "Number of Blows: %d", p_ptr->num_blow[0]);
3649 put_str(tmp_str, row+1, col);
3651 /* Print to_hit and to_dam of the weapon */
3653 sprintf(tmp_str, "Ì¿ÃæΨ: 0 50 100 150 200 (Ũ¤ÎAC)");
3655 sprintf(tmp_str, "To Hit: 0 50 100 150 200 (AC)");
3658 put_str(tmp_str, row+2, col);
3660 /* Print the weapons base damage dice */
3662 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));
3664 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));
3667 put_str(tmp_str, row+3, col);
3670 c_put_str(TERM_YELLOW, "²Äǽ¤Ê¥À¥á¡¼¥¸:", row+5, col);
3672 c_put_str(TERM_YELLOW, "Possible Damage:", row+5, col);
3676 /* Damage for one blow (if it hits) */
3678 sprintf(tmp_str, "¹¶·â°ì²ó¤Ë¤Ä¤ %d-%d",
3680 sprintf(tmp_str, "One Strike: %d-%d damage",
3683 eff_dd + o_ptr->to_d + p_ptr->to_d[0],
3684 eff_ds * eff_dd + o_ptr->to_d + p_ptr->to_d[0]);
3685 put_str(tmp_str, row+6, col+1);
3687 /* Damage for the complete attack (if all blows hit) */
3689 sprintf(tmp_str, "£±¥¿¡¼¥ó¤Ë¤Ä¤ %d-%d",
3691 sprintf(tmp_str, "One Attack: %d-%d damage",
3694 p_ptr->num_blow[0] * (eff_dd + o_ptr->to_d + p_ptr->to_d[0]),
3695 p_ptr->num_blow[0] * (eff_ds * eff_dd + o_ptr->to_d + p_ptr->to_d[0]));
3696 put_str(tmp_str, row+7, col+1);
3701 * Hook to specify "weapon"
3703 static bool item_tester_hook_melee_weapon(object_type *o_ptr)
3705 switch (o_ptr->tval)
3715 if (o_ptr->sval != SV_DOKUBARI) return (TRUE);
3724 * Hook to specify "ammo"
3726 static bool item_tester_hook_ammo(object_type *o_ptr)
3728 switch (o_ptr->tval)
3745 * Copies the weapons to compare into the weapon-slot and
3746 * compares the values for both weapons.
3748 static int compare_weapons(int bcost)
3752 object_type *o_ptr[2];
3753 object_type orig_weapon;
3757 int wid = 38, mgn = 2;
3758 bool old_character_xtra = character_xtra;
3761 int cost = 0; /* First time no price */
3763 /* Save the screen */
3766 /* Clear the screen */
3769 /* Store copy of original wielded weapon */
3770 i_ptr = &inventory[INVEN_RARM];
3771 object_copy(&orig_weapon, i_ptr);
3773 /* Only compare melee weapons */
3774 item_tester_no_ryoute = TRUE;
3775 item_tester_hook = item_tester_hook_melee_weapon;
3777 /* Get the first weapon */
3778 q = _("Âè°ì¤ÎÉð´ï¤Ï¡©", "What is your first weapon? ");
3779 s = _("Èæ¤Ù¤ë¤â¤Î¤¬¤¢¤ê¤Þ¤»¤ó¡£", "You have nothing to compare.");
3781 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN)))
3787 /* Get the item (in the pack) */
3788 o_ptr[0] = &inventory[item];
3794 /* Clear the screen */
3797 /* Only compare melee weapons */
3798 item_tester_no_ryoute = TRUE;
3799 item_tester_hook = item_tester_hook_melee_weapon;
3801 /* Hack -- prevent "icky" message */
3802 character_xtra = TRUE;
3804 /* Diaplay selected weapon's infomation */
3805 for (i = 0; i < n; i++)
3807 int col = (wid * i + mgn);
3809 /* Copy i-th weapon into the weapon slot (if it's not already there) */
3810 if (o_ptr[i] != i_ptr) object_copy(i_ptr, o_ptr[i]);
3812 /* Get the new values */
3815 /* List the new values */
3816 list_weapon(o_ptr[i], row, col);
3817 compare_weapon_aux(o_ptr[i], col, row + 8);
3819 /* Copy back the original weapon into the weapon slot */
3820 object_copy(i_ptr, &orig_weapon);
3823 /* Reset the values for the old weapon */
3826 character_xtra = old_character_xtra;
3829 put_str(format("[ Èæ³ÓÂоÝ: 's'¤ÇÊѹ¹ ($%d) ]", cost), 1, (wid + mgn));
3830 put_str("(°ìÈֹ⤤¥À¥á¡¼¥¸¤¬Å¬ÍѤµ¤ì¤Þ¤¹¡£Ê£¿ô¤ÎÇÜÂǸú²Ì¤Ï¤·»»¤µ¤ì¤Þ¤»¤ó¡£)", row + 4, 0);
3831 prt("¸½ºß¤Îµ»Î̤«¤éȽÃǤ¹¤ë¤È¡¢¤¢¤Ê¤¿¤ÎÉð´ï¤Ï°Ê²¼¤Î¤è¤¦¤Ê°ÒÎϤòȯ´ø¤·¤Þ¤¹:", 0, 0);
3833 put_str(format("[ 's' Select secondary weapon($%d) ]", cost), row + 1, (wid * i + mgn));
3834 put_str("(Only highest damage applies per monster. Special damage not cumulative.)", row + 4, 0);
3835 prt("Based on your current abilities, here is what your weapons will do", 0, 0);
3843 if (total + cost > p_ptr->au)
3845 msg_print(_("¤ª¶â¤¬Â¤ê¤Þ¤»¤ó¡ª", "You don't have enough money!"));
3850 q = _("ÂèÆó¤ÎÉð´ï¤Ï¡©", "What is your second weapon? ");
3851 s = _("Èæ¤Ù¤ë¤â¤Î¤¬¤¢¤ê¤Þ¤»¤ó¡£", "You have nothing to compare.");
3853 /* Get the second weapon */
3854 if (!get_item(&item2, q, s, (USE_EQUIP | USE_INVEN))) continue;
3859 /* Get the item (in the pack) */
3860 o_ptr[1] = &inventory[item2];
3869 /* Restore the screen */
3880 * AC¤«¤é²óÈòΨ¡¢¥À¥á¡¼¥¸¸º¾¯Î¨¤ò·×»»¤·É½¼¨¤¹¤ë
3881 * Calculate and display the dodge-rate and the protection-rate
3884 static bool eval_ac(int iAC)
3888 "¥À¥á¡¼¥¸·Ú¸ºÎ¨¤È¤Ï¡¢Å¨¤Î¹¶·â¤¬Åö¤¿¤Ã¤¿»þ¤½¤Î¥À¥á¡¼¥¸¤ò\n"
3889 "²¿¥Ñ¡¼¥»¥ó¥È·Ú¸º¤¹¤ë¤«¤ò¼¨¤·¤Þ¤¹¡£\n"
3890 "¥À¥á¡¼¥¸·Ú¸º¤ÏÄ̾ï¤ÎľÀܹ¶·â(¼ïÎब¡Ö¹¶·â¤¹¤ë¡×¤È¡ÖÊ´ºÕ¤¹¤ë¡×¤Îʪ)\n"
3891 "¤ËÂФ·¤Æ¤Î¤ß¸ú²Ì¤¬¤¢¤ê¤Þ¤¹¡£\n \n"
3892 "Ũ¤Î¥ì¥Ù¥ë¤È¤Ï¡¢¤½¤ÎŨ¤¬Ä̾ﲿ³¬¤Ë¸½¤ì¤ë¤«¤ò¼¨¤·¤Þ¤¹¡£\n \n"
3893 "²óÈòΨ¤ÏŨ¤ÎľÀܹ¶·â¤ò²¿¥Ñ¡¼¥»¥ó¥È¤Î³ÎΨ¤ÇÈò¤±¤ë¤«¤ò¼¨¤·¡¢\n"
3894 "Ũ¤Î¥ì¥Ù¥ë¤È¤¢¤Ê¤¿¤ÎAC¤Ë¤è¤Ã¤Æ·èÄꤵ¤ì¤Þ¤¹¡£\n \n"
3895 "¥À¥á¡¼¥¸´üÂÔÃͤȤϡ¢Å¨¤Î£±£°£°¥Ý¥¤¥ó¥È¤ÎÄ̾ﹶ·â¤ËÂФ·¡¢\n"
3896 "²óÈòΨ¤È¥À¥á¡¼¥¸·Ú¸ºÎ¨¤ò¹Íθ¤·¤¿¥À¥á¡¼¥¸¤Î´üÂÔÃͤò¼¨¤·¤Þ¤¹¡£\n";
3899 "'Protection Rate' means how much damage is reduced by your armor.\n"
3900 "Note that the Protection rate is effective only against normal "
3901 "'attack' and 'shatter' type melee attacks, "
3902 "and has no effect against any other types such as 'poison'.\n \n"
3903 "'Dodge Rate' indicates the success rate on dodging the "
3904 "monster's melee attacks. "
3905 "It is depend on the level of the monster and your AC.\n \n"
3906 "'Average Damage' indicates the expected amount of damage "
3907 "when you are attacked by normal melee attacks with power=100.";
3913 char buf[80*20], *t;
3915 /* AC lower than zero has no effect */
3916 if (iAC < 0) iAC = 0;
3918 /* ¥À¥á¡¼¥¸·Ú¸ºÎ¨¤ò·×»» */
3919 protection = 100 * MIN(iAC, 150) / 250;
3925 put_str(format("¤¢¤Ê¤¿¤Î¸½ºß¤ÎAC: %3d", iAC), row++, 0);
3926 put_str(format("¥À¥á¡¼¥¸·Ú¸ºÎ¨ : %3d%%", protection), row++, 0);
3929 put_str("Ũ¤Î¥ì¥Ù¥ë :", row + 0, 0);
3930 put_str("²óÈòΨ :", row + 1, 0);
3931 put_str("¥À¥á¡¼¥¸´üÂÔÃÍ :", row + 2, 0);
3933 put_str(format("Your current AC : %3d", iAC), row++, 0);
3934 put_str(format("Protection rate : %3d%%", protection), row++, 0);
3937 put_str("Level of Monster:", row + 0, 0);
3938 put_str("Dodge Rate :", row + 1, 0);
3939 put_str("Average Damage :", row + 2, 0);
3942 for (col = 17 + 1, lvl = 0; lvl <= 100; lvl += 10, col += 5)
3944 int quality = 60 + lvl * 3; /* attack quality with power 60 */
3945 int dodge; /* ²óÈòΨ(%) */
3946 int average; /* ¥À¥á¡¼¥¸´üÂÔÃÍ */
3948 put_str(format("%3d", lvl), row + 0, col);
3951 dodge = 5 + (MIN(100, 100 * (iAC * 3 / 4) / quality) * 9 + 5) / 10;
3952 put_str(format("%3d%%", dodge), row + 1, col);
3954 /* 100ÅÀ¤Î¹¶·â¤ËÂФ·¤Æ¤Î¥À¥á¡¼¥¸´üÂÔÃͤò·×»» */
3955 average = (100 - dodge) * (100 - protection) / 100;
3956 put_str(format("%3d", average), row + 2, col);
3960 roff_to_buf(memo, 70, buf, sizeof(buf));
3961 for (t = buf; t[0]; t += strlen(t) + 1)
3962 put_str(t, (row++) + 4, 4);
3965 prt("¸½ºß¤Î¤¢¤Ê¤¿¤ÎÁõÈ÷¤«¤é¤¹¤ë¤È¡¢¤¢¤Ê¤¿¤ÎËɸæÎϤÏ"
3966 "¤³¤ì¤¯¤é¤¤¤Ç¤¹:", 0, 0);
3968 prt("Defense abilities from your current Armor Class are evaluated below.", 0, 0);
3981 * Hook to specify "broken weapon"
3983 static bool item_tester_hook_broken_weapon(object_type *o_ptr)
3985 if (o_ptr->tval != TV_SWORD) return FALSE;
3987 switch (o_ptr->sval)
3989 case SV_BROKEN_DAGGER:
3990 case SV_BROKEN_SWORD:
3997 static void give_one_ability_of_object(object_type *to_ptr, object_type *from_ptr)
4000 int cand[TR_FLAG_MAX];
4001 u32b to_flgs[TR_FLAG_SIZE];
4002 u32b from_flgs[TR_FLAG_SIZE];
4004 object_flags(to_ptr, to_flgs);
4005 object_flags(from_ptr, from_flgs);
4007 for (i = 0; i < TR_FLAG_MAX; i++)
4011 case TR_IGNORE_ACID:
4012 case TR_IGNORE_ELEC:
4013 case TR_IGNORE_FIRE:
4014 case TR_IGNORE_COLD:
4023 case TR_FIXED_FLAVOR:
4026 if (have_flag(from_flgs, i) && !have_flag(to_flgs, i))
4028 if (!(is_pval_flag(i) && (from_ptr->pval < 1))) cand[n++] = i;
4036 int tr_idx = cand[randint0(n)];
4037 add_flag(to_ptr->art_flags, tr_idx);
4038 if (is_pval_flag(tr_idx)) to_ptr->pval = MAX(to_ptr->pval, 1);
4039 bmax = MIN(3, MAX(1, 40 / (to_ptr->dd * to_ptr->ds)));
4040 if (tr_idx == TR_BLOWS) to_ptr->pval = MIN(to_ptr->pval, bmax);
4041 if (tr_idx == TR_SPEED) to_ptr->pval = MIN(to_ptr->pval, 4);
4048 * Repair broken weapon
4050 static int repair_broken_weapon_aux(int bcost)
4054 object_type *o_ptr, *mo_ptr; /* broken weapon and material weapon */
4056 int i, k_idx, dd_bonus, ds_bonus;
4057 char basenm[MAX_NLEN];
4058 cptr q, s; /* For get_item prompt */
4065 prt(_("½¤Éü¤Ë¤ÏºàÎÁ¤È¤Ê¤ë¤â¤¦1¤Ä¤ÎÉð´ï¤¬É¬ÍפǤ¹¡£", "Hand one material weapon to repair a broken weapon."), row, 2);
4066 prt(_("ºàÎÁ¤Ë»ÈÍѤ·¤¿Éð´ï¤Ï¤Ê¤¯¤Ê¤ê¤Þ¤¹¡ª", "The material weapon will disappear after repairing!!"), row+1, 2);
4069 q = _("¤É¤ÎÀޤ줿Éð´ï¤ò½¤Éü¤·¤Þ¤¹¤«¡©", "Repair which broken weapon? ");
4070 s = _("½¤Éü¤Ç¤¤ëÀޤ줿Éð´ï¤¬¤¢¤ê¤Þ¤»¤ó¡£", "You have no broken weapon to repair.");
4072 /* Only forge broken weapons */
4073 item_tester_hook = item_tester_hook_broken_weapon;
4075 if (!get_item(&item, q, s, (USE_INVEN | USE_EQUIP))) return (0);
4077 /* Get the item (in the pack) */
4078 o_ptr = &inventory[item];
4080 /* It is worthless */
4081 if (!object_is_ego(o_ptr) && !object_is_artifact(o_ptr))
4083 msg_format(_("¤½¤ì¤Ïľ¤·¤Æ¤â¤·¤ç¤¦¤¬¤Ê¤¤¤¼¡£", "It is worthless to repair."));
4087 /* They are too many */
4088 if (o_ptr->number > 1)
4090 msg_format(_("°ìÅÙ¤ËÊ£¿ô¤ò½¤Éü¤¹¤ë¤³¤È¤Ï¤Ç¤¤Þ¤»¤ó¡ª", "They are too many to repair at once!"));
4094 /* Display item name */
4095 object_desc(basenm, o_ptr, OD_NAME_ONLY);
4096 prt(format(_("½¤Éü¤¹¤ëÉð´ï¡¡¡§ %s", "Repairing: %s"), basenm), row+3, 2);
4099 q = _("ºàÎÁ¤È¤Ê¤ëÉð´ï¤Ï¡©", "Which weapon for material? ");
4100 s = _("ºàÎÁ¤È¤Ê¤ëÉð´ï¤¬¤¢¤ê¤Þ¤»¤ó¡£", "You have no material to repair.");
4102 /* Only forge broken weapons */
4103 item_tester_hook = item_tester_hook_melee_weapon;
4105 if (!get_item(&mater, q, s, (USE_INVEN | USE_EQUIP))) return (0);
4108 msg_print(_("¥¯¥é¥¤¥ó¤ÎÄÛ¤¸¤ã¤Ê¤¤¡ª", "This is not a klein bottle!"));
4112 /* Get the item (in the pack) */
4113 mo_ptr = &inventory[mater];
4115 /* Display item name */
4116 object_desc(basenm, mo_ptr, OD_NAME_ONLY);
4117 prt(format(_("ºàÎÁ¤È¤¹¤ëÉð´ï¡§ %s", "Material : %s"), basenm), row+4, 2);
4119 /* Get the value of one of the items (except curses) */
4120 cost = bcost + object_value_real(o_ptr) * 2;
4123 if (!get_check(format("¡ð%d¤«¤«¤ê¤Þ¤¹¤¬¤è¤í¤·¤¤¤Ç¤¹¤«¡© ", cost))) return (0);
4125 if (!get_check(format("Costs %d gold, okay? ", cost))) return (0);
4128 /* Check if the player has enough money */
4129 if (p_ptr->au < cost)
4131 object_desc(basenm, o_ptr, OD_NAME_ONLY);
4132 msg_format(_("%s¤ò½¤Éü¤¹¤ë¤À¤±¤Î¥´¡¼¥ë¥É¤¬¤¢¤ê¤Þ¤»¤ó¡ª",
4133 "You do not have the gold to repair %s!"), basenm);
4138 if (o_ptr->sval == SV_BROKEN_DAGGER)
4142 /* Suppress compiler warning */
4145 for (i = 1; i < max_k_idx; i++)
4147 object_kind *k_ptr = &k_info[i];
4149 if (k_ptr->tval != TV_SWORD) continue;
4150 if ((k_ptr->sval == SV_BROKEN_DAGGER) ||
4151 (k_ptr->sval == SV_BROKEN_SWORD) ||
4152 (k_ptr->sval == SV_DOKUBARI)) continue;
4153 if (k_ptr->weight > 99) continue;
4162 else /* TV_BROKEN_SWORD */
4164 /* Repair to a sword or sometimes material's type weapon */
4165 int tval = (one_in_(5) ? mo_ptr->tval : TV_SWORD);
4169 object_kind *ck_ptr;
4171 k_idx = lookup_kind(tval, SV_ANY);
4172 ck_ptr = &k_info[k_idx];
4174 if (tval == TV_SWORD)
4176 if ((ck_ptr->sval == SV_BROKEN_DAGGER) ||
4177 (ck_ptr->sval == SV_BROKEN_SWORD) ||
4178 (ck_ptr->sval == SV_DIAMOND_EDGE) ||
4179 (ck_ptr->sval == SV_DOKUBARI)) continue;
4181 if (tval == TV_POLEARM)
4183 if ((ck_ptr->sval == SV_DEATH_SCYTHE) ||
4184 (ck_ptr->sval == SV_TSURIZAO)) continue;
4186 if (tval == TV_HAFTED)
4188 if ((ck_ptr->sval == SV_GROND) ||
4189 (ck_ptr->sval == SV_WIZSTAFF) ||
4190 (ck_ptr->sval == SV_NAMAKE_HAMMER)) continue;
4197 /* Calculate dice bonuses */
4198 dd_bonus = o_ptr->dd - k_info[o_ptr->k_idx].dd;
4199 ds_bonus = o_ptr->ds - k_info[o_ptr->k_idx].ds;
4200 dd_bonus += mo_ptr->dd - k_info[mo_ptr->k_idx].dd;
4201 ds_bonus += mo_ptr->ds - k_info[mo_ptr->k_idx].ds;
4203 /* Change base object */
4204 k_ptr = &k_info[k_idx];
4205 o_ptr->k_idx = k_idx;
4206 o_ptr->weight = k_ptr->weight;
4207 o_ptr->tval = k_ptr->tval;
4208 o_ptr->sval = k_ptr->sval;
4209 o_ptr->dd = k_ptr->dd;
4210 o_ptr->ds = k_ptr->ds;
4212 /* Copy base object's ability */
4213 for (i = 0; i < TR_FLAG_SIZE; i++) o_ptr->art_flags[i] |= k_ptr->flags[i];
4214 if (k_ptr->pval) o_ptr->pval = MAX(o_ptr->pval, randint1(k_ptr->pval));
4215 if (have_flag(k_ptr->flags, TR_ACTIVATE)) o_ptr->xtra2 = k_ptr->act_idx;
4221 for (i = 0; i < dd_bonus; i++)
4223 if (one_in_(o_ptr->dd + i)) o_ptr->dd++;
4229 for (i = 0; i < ds_bonus; i++)
4231 if (one_in_(o_ptr->ds + i)) o_ptr->ds++;
4236 if (have_flag(k_ptr->flags, TR_BLOWS))
4238 int bmax = MIN(3, MAX(1, 40 / (o_ptr->dd * o_ptr->ds)));
4239 o_ptr->pval = MIN(o_ptr->pval, bmax);
4242 /* Add one random ability from material weapon */
4243 give_one_ability_of_object(o_ptr, mo_ptr);
4245 /* Add to-dam, to-hit and to-ac from material weapon */
4246 o_ptr->to_d += MAX(0, (mo_ptr->to_d / 3));
4247 o_ptr->to_h += MAX(0, (mo_ptr->to_h / 3));
4248 o_ptr->to_a += MAX(0, (mo_ptr->to_a));
4250 if ((o_ptr->name1 == ART_NARSIL) ||
4251 (object_is_random_artifact(o_ptr) && one_in_(1)) ||
4252 (object_is_ego(o_ptr) && one_in_(7)))
4255 if (object_is_ego(o_ptr))
4257 add_flag(o_ptr->art_flags, TR_IGNORE_FIRE);
4258 add_flag(o_ptr->art_flags, TR_IGNORE_ACID);
4261 /* Add one random ability from material weapon */
4262 give_one_ability_of_object(o_ptr, mo_ptr);
4264 /* Add one random activation */
4265 if (!activation_index(o_ptr)) one_activation(o_ptr);
4268 if (o_ptr->name1 == ART_NARSIL)
4270 one_high_resistance(o_ptr);
4274 msg_print(_("¤³¤ì¤Ï¤«¤Ê¤ê¤Î¶Èʪ¤À¤Ã¤¿¤è¤¦¤À¡£", "This blade seems to be exceptionally."));
4277 object_desc(basenm, o_ptr, OD_NAME_ONLY);
4279 msg_format("¡ð%d¤Ç%s¤Ë½¤Éü¤·¤Þ¤·¤¿¡£", cost, basenm);
4281 msg_format("Repaired into %s for %d gold.", basenm, cost);
4285 /* Remove BROKEN flag */
4286 o_ptr->ident &= ~(IDENT_BROKEN);
4288 /* Add repaired flag */
4289 o_ptr->discount = 99;
4291 /* Decrease material object */
4292 inven_item_increase(mater, -1);
4293 inven_item_optimize(mater);
4296 p_ptr->update |= PU_BONUS;
4299 /* Something happened */
4303 static int repair_broken_weapon(int bcost)
4308 cost = repair_broken_weapon_aux(bcost);
4317 static bool enchant_item(int cost, int to_hit, int to_dam, int to_ac)
4323 int maxenchant = (p_ptr->lev / 5);
4324 char tmp_str[MAX_NLEN];
4328 prt(format("¸½ºß¤Î¤¢¤Ê¤¿¤Îµ»Î̤À¤È¡¢+%d ¤Þ¤Ç²þÎɤǤ¤Þ¤¹¡£", maxenchant), 5, 0);
4329 prt(format(" ²þÎɤÎÎÁ¶â¤Ï°ì¸Ä¤Ë¤Ä¤¡ð%d ¤Ç¤¹¡£", cost), 7, 0);
4331 prt(format(" Based on your skill, we can improve up to +%d.", maxenchant), 5, 0);
4332 prt(format(" The price for the service is %d gold per item.", cost), 7, 0);
4335 item_tester_no_ryoute = TRUE;
4339 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò²þÎɤ·¤Þ¤¹¤«¡©";
4340 s = "²þÎɤǤ¤ë¤â¤Î¤¬¤¢¤ê¤Þ¤»¤ó¡£";
4342 q = "Improve which item? ";
4343 s = "You have nothing to improve.";
4346 if (!get_item(&item, q, s, (USE_INVEN | USE_EQUIP))) return (FALSE);
4348 /* Get the item (in the pack) */
4349 o_ptr = &inventory[item];
4351 /* Check if the player has enough money */
4352 if (p_ptr->au < (cost * o_ptr->number))
4354 object_desc(tmp_str, o_ptr, OD_NAME_ONLY);
4356 msg_format("%s¤ò²þÎɤ¹¤ë¤À¤±¤Î¥´¡¼¥ë¥É¤¬¤¢¤ê¤Þ¤»¤ó¡ª", tmp_str);
4358 msg_format("You do not have the gold to improve %s!", tmp_str);
4364 /* Enchant to hit */
4365 for (i = 0; i < to_hit; i++)
4367 if (o_ptr->to_h < maxenchant)
4369 if (enchant(o_ptr, 1, (ENCH_TOHIT | ENCH_FORCE)))
4377 /* Enchant to damage */
4378 for (i = 0; i < to_dam; i++)
4380 if (o_ptr->to_d < maxenchant)
4382 if (enchant(o_ptr, 1, (ENCH_TODAM | ENCH_FORCE)))
4391 for (i = 0; i < to_ac; i++)
4393 if (o_ptr->to_a < maxenchant)
4395 if (enchant(o_ptr, 1, (ENCH_TOAC | ENCH_FORCE)))
4407 if (flush_failure) flush();
4411 msg_print("²þÎɤ˼ºÇÔ¤·¤¿¡£");
4413 msg_print("The improvement failed.");
4420 object_desc(tmp_str, o_ptr, OD_NAME_AND_ENCHANT);
4422 msg_format("¡ð%d¤Ç%s¤Ë²þÎɤ·¤Þ¤·¤¿¡£", cost * o_ptr->number, tmp_str);
4424 msg_format("Improved into %s for %d gold.", tmp_str, cost * o_ptr->number);
4427 /* Charge the money */
4428 p_ptr->au -= (cost * o_ptr->number);
4430 if (item >= INVEN_RARM) calc_android_exp();
4432 /* Something happened */
4439 * Recharge rods, wands and staves
4441 * The player can select the number of charges to add
4442 * (up to a limit), and the recharge never fails.
4444 * The cost for rods depends on the level of the rod. The prices
4445 * for recharging wands and staves are dependent on the cost of
4448 static void building_recharge(void)
4457 char tmp_str[MAX_NLEN];
4461 /* Display some info */
4464 prt(" ºÆ½¼Å¶¤ÎÈñÍѤϥ¢¥¤¥Æ¥à¤Î¼ïÎà¤Ë¤è¤ê¤Þ¤¹¡£", 6, 0);
4466 prt(" The prices of recharge depend on the type.", 6, 0);
4470 /* Only accept legal items */
4471 item_tester_hook = item_tester_hook_recharge;
4475 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ËËâÎϤò½¼Å¶¤·¤Þ¤¹¤«? ";
4476 s = "ËâÎϤò½¼Å¶¤¹¤Ù¤¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡£";
4478 q = "Recharge which item? ";
4479 s = "You have nothing to recharge.";
4482 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
4484 /* Get the item (in the pack) */
4487 o_ptr = &inventory[item];
4490 /* Get the item (on the floor) */
4493 o_ptr = &o_list[0 - item];
4496 k_ptr = &k_info[o_ptr->k_idx];
4499 * We don't want to give the player free info about
4500 * the level of the item or the number of charges.
4502 /* The item must be "known" */
4503 if (!object_is_known(o_ptr))
4506 msg_format("½¼Å¶¤¹¤ëÁ°¤Ë´ÕÄꤵ¤ì¤Æ¤¤¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡ª");
4508 msg_format("The item must be identified first!");
4513 if ((p_ptr->au >= 50) &&
4515 get_check("¡ð50¤Ç´ÕÄꤷ¤Þ¤¹¤«¡© "))
4517 get_check("Identify for 50 gold? "))
4525 identify_item(o_ptr);
4528 object_desc(tmp_str, o_ptr, 0);
4531 msg_format("%s ¤Ç¤¹¡£", tmp_str);
4533 msg_format("You have: %s.", tmp_str);
4536 /* Auto-inscription */
4537 autopick_alter_item(item, FALSE);
4539 /* Update the gold display */
4540 building_prt_gold();
4548 /* Extract the object "level" */
4549 lev = k_info[o_ptr->k_idx].level;
4551 /* Price for a rod */
4552 if (o_ptr->tval == TV_ROD)
4554 if (o_ptr->timeout > 0)
4556 /* Fully recharge */
4557 price = (lev * 50 * o_ptr->timeout) / k_ptr->pval;
4561 /* No recharge necessary */
4564 msg_format("¤½¤ì¤ÏºÆ½¼Å¶¤¹¤ëɬÍפϤ¢¤ê¤Þ¤»¤ó¡£");
4566 msg_format("That doesn't need to be recharged.");
4572 else if (o_ptr->tval == TV_STAFF)
4574 /* Price per charge ( = double the price paid by shopkeepers for the charge) */
4575 price = (k_info[o_ptr->k_idx].cost / 10) * o_ptr->number;
4577 /* Pay at least 10 gold per charge */
4578 price = MAX(10, price);
4582 /* Price per charge ( = double the price paid by shopkeepers for the charge) */
4583 price = (k_info[o_ptr->k_idx].cost / 10);
4585 /* Pay at least 10 gold per charge */
4586 price = MAX(10, price);
4589 /* Limit the number of charges for wands and staffs */
4590 if (o_ptr->tval == TV_WAND
4591 && (o_ptr->pval / o_ptr->number >= k_ptr->pval))
4593 if (o_ptr->number > 1)
4596 msg_print("¤³¤ÎËâË¡ËÀ¤Ï¤â¤¦½¼Ê¬¤Ë½¼Å¶¤µ¤ì¤Æ¤¤¤Þ¤¹¡£");
4598 msg_print("These wands are already fully charged.");
4604 msg_print("¤³¤ÎËâË¡ËÀ¤Ï¤â¤¦½¼Ê¬¤Ë½¼Å¶¤µ¤ì¤Æ¤¤¤Þ¤¹¡£");
4606 msg_print("This wand is already fully charged.");
4611 else if (o_ptr->tval == TV_STAFF && o_ptr->pval >= k_ptr->pval)
4613 if (o_ptr->number > 1)
4616 msg_print("¤³¤Î¾ó¤Ï¤â¤¦½¼Ê¬¤Ë½¼Å¶¤µ¤ì¤Æ¤¤¤Þ¤¹¡£");
4618 msg_print("These staffs are already fully charged.");
4624 msg_print("¤³¤Î¾ó¤Ï¤â¤¦½¼Ê¬¤Ë½¼Å¶¤µ¤ì¤Æ¤¤¤Þ¤¹¡£");
4626 msg_print("This staff is already fully charged.");
4632 /* Check if the player has enough money */
4633 if (p_ptr->au < price)
4635 object_desc(tmp_str, o_ptr, OD_NAME_ONLY);
4637 msg_format("%s¤òºÆ½¼Å¶¤¹¤ë¤Ë¤Ï¡ð%d ɬÍפǤ¹¡ª", tmp_str,price );
4639 msg_format("You need %d gold to recharge %s!", price, tmp_str);
4645 if (o_ptr->tval == TV_ROD)
4648 if (get_check(format("¤½¤Î¥í¥Ã¥É¤ò¡ð%d ¤ÇºÆ½¼Å¶¤·¤Þ¤¹¤«¡©",
4651 if (get_check(format("Recharge the %s for %d gold? ",
4652 ((o_ptr->number > 1) ? "rods" : "rod"), price)))
4656 /* Recharge fully */
4666 if (o_ptr->tval == TV_STAFF)
4667 max_charges = k_ptr->pval - o_ptr->pval;
4669 max_charges = o_ptr->number * k_ptr->pval - o_ptr->pval;
4671 /* Get the quantity for staves and wands */
4673 charges = get_quantity(format("°ì²óʬ¡ð%d ¤Ç²¿²óʬ½¼Å¶¤·¤Þ¤¹¤«¡©",
4675 charges = get_quantity(format("Add how many charges for %d gold? ",
4678 price), MIN(p_ptr->au / price, max_charges));
4681 if (charges < 1) return;
4683 /* Get the new price */
4687 o_ptr->pval += charges;
4689 /* We no longer think the item is empty */
4690 o_ptr->ident &= ~(IDENT_EMPTY);
4694 object_desc(tmp_str, o_ptr, 0);
4696 msg_format("%s¤ò¡ð%d ¤ÇºÆ½¼Å¶¤·¤Þ¤·¤¿¡£", tmp_str, price);
4698 msg_format("%^s %s recharged for %d gold.", tmp_str, ((o_ptr->number > 1) ? "were" : "was"), price);
4701 /* Combine / Reorder the pack (later) */
4702 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
4705 p_ptr->window |= (PW_INVEN);
4716 * Recharge rods, wands and staves
4718 * The player can select the number of charges to add
4719 * (up to a limit), and the recharge never fails.
4721 * The cost for rods depends on the level of the rod. The prices
4722 * for recharging wands and staves are dependent on the cost of
4725 static void building_recharge_all(void)
4735 /* Display some info */
4739 prt(" ºÆ½¼Å¶¤ÎÈñÍѤϥ¢¥¤¥Æ¥à¤Î¼ïÎà¤Ë¤è¤ê¤Þ¤¹¡£", 6, 0);
4741 prt(" The prices of recharge depend on the type.", 6, 0);
4744 /* Calculate cost */
4745 for ( i = 0; i < INVEN_PACK; i++)
4747 o_ptr = &inventory[i];
4749 /* skip non magic device */
4750 if (o_ptr->tval < TV_STAFF || o_ptr->tval > TV_ROD) continue;
4752 /* need identified */
4753 if (!object_is_known(o_ptr)) total_cost += 50;
4755 /* Extract the object "level" */
4756 lev = k_info[o_ptr->k_idx].level;
4758 k_ptr = &k_info[o_ptr->k_idx];
4760 switch (o_ptr->tval)
4763 price = (lev * 50 * o_ptr->timeout) / k_ptr->pval;
4767 /* Price per charge ( = double the price paid by shopkeepers for the charge) */
4768 price = (k_info[o_ptr->k_idx].cost / 10) * o_ptr->number;
4770 /* Pay at least 10 gold per charge */
4771 price = MAX(10, price);
4774 price = (k_ptr->pval - o_ptr->pval) * price;
4778 /* Price per charge ( = double the price paid by shopkeepers for the charge) */
4779 price = (k_info[o_ptr->k_idx].cost / 10);
4781 /* Pay at least 10 gold per charge */
4782 price = MAX(10, price);
4785 price = (o_ptr->number * k_ptr->pval - o_ptr->pval) * price;
4789 /* if price <= 0 then item have enough charge */
4790 if (price > 0) total_cost += price;
4796 msg_print("½¼Å¶¤¹¤ëɬÍפϤ¢¤ê¤Þ¤»¤ó¡£");
4798 msg_print("No need to recharge.");
4805 /* Check if the player has enough money */
4806 if (p_ptr->au < total_cost)
4809 msg_format("¤¹¤Ù¤Æ¤Î¥¢¥¤¥Æ¥à¤òºÆ½¼Å¶¤¹¤ë¤Ë¤Ï¡ð%d ɬÍפǤ¹¡ª", total_cost );
4811 msg_format("You need %d gold to recharge all items!",total_cost);
4819 if (!get_check(format("¤¹¤Ù¤Æ¤Î¥¢¥¤¥Æ¥à¤ò ¡ð%d ¤ÇºÆ½¼Å¶¤·¤Þ¤¹¤«¡©", total_cost))) return;
4821 if (!get_check(format("Recharge all items for %d gold? ", total_cost))) return;
4824 for (i = 0; i < INVEN_PACK; i++)
4826 o_ptr = &inventory[i];
4827 k_ptr = &k_info[o_ptr->k_idx];
4829 /* skip non magic device */
4830 if (o_ptr->tval < TV_STAFF || o_ptr->tval > TV_ROD) continue;
4833 if (!object_is_known(o_ptr))
4835 identify_item(o_ptr);
4837 /* Auto-inscription */
4838 autopick_alter_item(i, FALSE);
4842 switch (o_ptr->tval)
4848 if (o_ptr->pval < k_ptr->pval) o_ptr->pval = k_ptr->pval;
4849 /* We no longer think the item is empty */
4850 o_ptr->ident &= ~(IDENT_EMPTY);
4853 if (o_ptr->pval < o_ptr->number * k_ptr->pval)
4854 o_ptr->pval = o_ptr->number * k_ptr->pval;
4855 /* We no longer think the item is empty */
4856 o_ptr->ident &= ~(IDENT_EMPTY);
4863 msg_format("¡ð%d ¤ÇºÆ½¼Å¶¤·¤Þ¤·¤¿¡£", total_cost);
4865 msg_format("You pay %d gold.", total_cost);
4870 /* Combine / Reorder the pack (later) */
4871 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
4874 p_ptr->window |= (PW_INVEN);
4877 p_ptr->au -= total_cost;
4884 bool tele_town(void)
4892 msg_print("¤³¤ÎËâË¡¤ÏÃϾå¤Ç¤·¤«»È¤¨¤Ê¤¤¡ª");
4894 msg_print("This spell can only be used on the surface!");
4899 if (p_ptr->inside_arena || p_ptr->inside_battle)
4902 msg_print("¤³¤ÎËâË¡¤Ï³°¤Ç¤·¤«»È¤¨¤Ê¤¤¡ª");
4904 msg_print("This spell can only be used outside!");
4912 for (i=1;i<max_towns;i++)
4916 if ((i == NO_TOWN) || (i == SECRET_TOWN) || (i == p_ptr->town_num) || !(p_ptr->visit & (1L << (i-1)))) continue;
4918 sprintf(buf,"%c) %-20s", I2A(i-1), town[i].name);
4926 msg_print("¤Þ¤À¹Ô¤±¤ë¤È¤³¤í¤¬¤Ê¤¤¡£");
4928 msg_print("You have not yet visited any town.");
4937 prt("¤É¤³¤Ë¹Ô¤¤Þ¤¹¤«:", 0, 0);
4939 prt("Which town you go: ", 0, 0);
4950 else if ((i < 'a') || (i > ('a'+max_towns-2))) continue;
4951 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;
4955 for (y = 0; y < max_wild_y; y++)
4957 for (x = 0; x < max_wild_x; x++)
4959 if(wilderness[y][x].town == (i-'a'+1))
4961 p_ptr->wilderness_y = y;
4962 p_ptr->wilderness_x = x;
4967 p_ptr->leaving = TRUE;
4969 p_ptr->teleport_town = TRUE;
4979 static bool research_mon(void)
4987 bool recall = FALSE;
4993 /* XTRA HACK WHATSEARCH */
4999 /* XTRA HACK REMEMBER_IDX */
5000 static int old_sym = '\0';
5001 static int old_i = 0;
5004 /* Save the screen */
5007 /* Get a character, or abort */
5009 if (!get_com("¥â¥ó¥¹¥¿¡¼¤Îʸ»ú¤òÆþÎϤ·¤Æ²¼¤µ¤¤(µ¹æ or ^AÁ´,^U¥æ,^NÈó¥æ,^M̾Á°):", &sym, FALSE))
5011 if (!get_com("Enter character to be identified(^A:All,^U:Uniqs,^N:Non uniqs,^M:Name): ", &sym, FALSE))
5021 /* Find that character info, and describe it */
5022 for (i = 0; ident_info[i]; ++i)
5024 if (sym == ident_info[i][0]) break;
5027 /* XTRA HACK WHATSEARCH */
5028 if (sym == KTRL('A'))
5032 strcpy(buf, "Á´¥â¥ó¥¹¥¿¡¼¤Î¥ê¥¹¥È");
5034 strcpy(buf, "Full monster list.");
5037 else if (sym == KTRL('U'))
5041 strcpy(buf, "¥æ¥Ë¡¼¥¯¡¦¥â¥ó¥¹¥¿¡¼¤Î¥ê¥¹¥È");
5043 strcpy(buf, "Unique monster list.");
5046 else if (sym == KTRL('N'))
5050 strcpy(buf, "¥æ¥Ë¡¼¥¯³°¥â¥ó¥¹¥¿¡¼¤Î¥ê¥¹¥È");
5052 strcpy(buf, "Non-unique monster list.");
5055 else if (sym == KTRL('M'))
5059 if (!get_string("̾Á°(±Ñ¸ì¤Î¾ì¹ç¾®Ê¸»ú¤Ç²Ä)",temp, 70))
5061 if (!get_string("Enter name:",temp, 70))
5072 sprintf(buf, "̾Á°:%s¤Ë¥Þ¥Ã¥Á",temp);
5074 sprintf(buf, "Monsters with a name \"%s\"",temp);
5077 else if (ident_info[i])
5079 sprintf(buf, "%c - %s.", sym, ident_info[i] + 2);
5084 sprintf(buf, "%c - %s", sym, "̵¸ú¤Êʸ»ú");
5086 sprintf(buf, "%c - %s.", sym, "Unknown Symbol");
5091 /* Display the result */
5095 /* Allocate the "who" array */
5096 C_MAKE(who, max_r_idx, u16b);
5098 /* Collect matching monsters */
5099 for (n = 0, i = 1; i < max_r_idx; i++)
5101 monster_race *r_ptr = &r_info[i];
5104 if (!r_ptr->name) continue;
5106 /* XTRA HACK WHATSEARCH */
5107 /* Require non-unique monsters if needed */
5108 if (norm && (r_ptr->flags1 & (RF1_UNIQUE))) continue;
5110 /* Require unique monsters if needed */
5111 if (uniq && !(r_ptr->flags1 & (RF1_UNIQUE))) continue;
5119 for (xx = 0; temp[xx] && xx < 80; xx++)
5122 if (iskanji(temp[xx]))
5128 if (isupper(temp[xx])) temp[xx] = tolower(temp[xx]);
5132 strcpy(temp2, r_name + r_ptr->E_name);
5134 strcpy(temp2, r_name + r_ptr->name);
5136 for (xx = 0; temp2[xx] && xx < 80; xx++)
5137 if (isupper(temp2[xx])) temp2[xx] = tolower(temp2[xx]);
5140 if (my_strstr(temp2, temp) || my_strstr(r_name + r_ptr->name, temp))
5142 if (my_strstr(temp2, temp))
5146 else if (all || (r_ptr->d_char == sym)) who[n++] = i;
5149 /* Nothing to recall */
5152 /* Free the "who" array */
5153 C_KILL(who, max_r_idx, u16b);
5165 /* Sort if needed */
5168 /* Select the sort method */
5169 ang_sort_comp = ang_sort_comp_hook;
5170 ang_sort_swap = ang_sort_swap_hook;
5172 /* Sort the array */
5173 ang_sort(who, &why, n);
5177 /* Start at the end */
5178 /* XTRA HACK REMEMBER_IDX */
5179 if (old_sym == sym && old_i < n) i = old_i;
5184 /* Scan the monster memory */
5187 /* Extract a race */
5190 /* Hack -- Begin the prompt */
5193 /* Hack -- Complete the prompt */
5195 Term_addstr(-1, TERM_WHITE, " ['r'»×¤¤½Ð, ' '¤Ç³¹Ô, ESC]");
5197 Term_addstr(-1, TERM_WHITE, " [(r)ecall, ESC, space to continue]");
5207 /*** Recall on screen ***/
5209 /* Get maximal info about this monster */
5210 lore_do_probe(r_idx);
5212 /* Save this monster ID */
5213 monster_race_track(r_idx);
5215 /* Hack -- Handle stuff */
5218 /* know every thing mode */
5219 screen_roff(r_idx, 0x01);
5222 /* XTRA HACK REMEMBER_IDX */
5230 /* Normal commands */
5231 if (query != 'r') break;
5238 if (query == ESCAPE) break;
5240 /* Move to "prev" monster */
5246 if (!expand_list) break;
5250 /* Move to "next" monster */
5256 if (!expand_list) break;
5262 /* Re-display the identity */
5263 /* prt(buf, 5, 5);*/
5265 /* Free the "who" array */
5266 C_KILL(who, max_r_idx, u16b);
5271 return (!notpicked);
5276 * Execute a building command
5278 static void bldg_process_command(building_type *bldg, int i)
5280 int bact = bldg->actions[i];
5285 /* Flush messages XXX XXX XXX */
5290 bcost = bldg->member_costs[i];
5292 bcost = bldg->other_costs[i];
5294 /* action restrictions */
5295 if (((bldg->action_restr[i] == 1) && !is_member(bldg)) ||
5296 ((bldg->action_restr[i] == 2) && !is_owner(bldg)))
5299 msg_print("¤½¤ì¤òÁªÂò¤¹¤ë¸¢Íø¤Ï¤¢¤ê¤Þ¤»¤ó¡ª");
5301 msg_print("You have no right to choose that!");
5306 /* check gold (HACK - Recharge uses variable costs) */
5307 if ((bact != BACT_RECHARGE) &&
5308 (((bldg->member_costs[i] > p_ptr->au) && is_owner(bldg)) ||
5309 ((bldg->other_costs[i] > p_ptr->au) && !is_owner(bldg))))
5312 msg_print("¤ª¶â¤¬Â¤ê¤Þ¤»¤ó¡ª");
5314 msg_print("You do not have the gold!");
5324 case BACT_RESEARCH_ITEM:
5325 paid = identify_fully(FALSE);
5327 case BACT_TOWN_HISTORY:
5330 case BACT_RACE_LEGENDS:
5336 case BACT_KING_LEGENDS:
5337 case BACT_ARENA_LEGENDS:
5342 case BACT_ARENA_RULES:
5346 case BACT_IN_BETWEEN:
5348 case BACT_SPIN_WHEEL:
5349 case BACT_DICE_SLOTS:
5350 case BACT_GAMBLE_RULES:
5357 paid = inn_comm(bact);
5359 case BACT_RESEARCH_MONSTER:
5360 paid = research_mon();
5362 case BACT_COMPARE_WEAPONS:
5364 bcost = compare_weapons(bcost);
5366 case BACT_ENCHANT_WEAPON:
5367 item_tester_hook = object_allow_enchant_melee_weapon;
5368 enchant_item(bcost, 1, 1, 0);
5370 case BACT_ENCHANT_ARMOR:
5371 item_tester_hook = object_is_armour;
5372 enchant_item(bcost, 0, 0, 1);
5375 building_recharge();
5377 case BACT_RECHARGE_ALL:
5378 building_recharge_all();
5380 case BACT_IDENTS: /* needs work */
5382 if (!get_check("»ý¤Áʪ¤òÁ´¤Æ´ÕÄꤷ¤Æ¤è¤í¤·¤¤¤Ç¤¹¤«¡©")) break;
5384 msg_print(" »ý¤ÁʪÁ´¤Æ¤¬´ÕÄꤵ¤ì¤Þ¤·¤¿¡£");
5386 if (!get_check("Do you pay for identify all your possession? ")) break;
5388 msg_print("Your possessions have been identified.");
5393 case BACT_IDENT_ONE: /* needs work */
5394 paid = ident_spell(FALSE);
5399 case BACT_HEALING: /* needs work */
5408 case BACT_RESTORE: /* needs work */
5409 if (do_res_stat(A_STR)) paid = TRUE;
5410 if (do_res_stat(A_INT)) paid = TRUE;
5411 if (do_res_stat(A_WIS)) paid = TRUE;
5412 if (do_res_stat(A_DEX)) paid = TRUE;
5413 if (do_res_stat(A_CON)) paid = TRUE;
5414 if (do_res_stat(A_CHR)) paid = TRUE;
5416 case BACT_ENCHANT_ARROWS:
5417 item_tester_hook = item_tester_hook_ammo;
5418 enchant_item(bcost, 1, 1, 0);
5420 case BACT_ENCHANT_BOW:
5421 item_tester_tval = TV_BOW;
5422 enchant_item(bcost, 1, 1, 0);
5425 if (recall_player(1)) paid = TRUE;
5427 case BACT_TELEPORT_LEVEL:
5434 select_dungeon = choose_dungeon("¤Ë¥Æ¥ì¥Ý¡¼¥È", 4, 0);
5436 select_dungeon = choose_dungeon("teleport", 4, 0);
5438 show_building(bldg);
5439 if (!select_dungeon) return;
5441 max_depth = d_info[select_dungeon].maxdepth;
5443 /* Limit depth in Angband */
5444 if (select_dungeon == DUNGEON_ANGBAND)
5446 if (quest[QUEST_OBERON].status != QUEST_STATUS_FINISHED) max_depth = 98;
5447 else if(quest[QUEST_SERPENT].status != QUEST_STATUS_FINISHED) max_depth = 99;
5451 amt = get_quantity(format("%s¤Î²¿³¬¤Ë¥Æ¥ì¥Ý¡¼¥È¤·¤Þ¤¹¤«¡©", d_name + d_info[select_dungeon].name), max_depth);
5453 amt = get_quantity(format("Teleport to which level of %s? ", d_name + d_info[select_dungeon].name), max_depth);
5458 p_ptr->word_recall = 1;
5459 p_ptr->recall_dungeon = select_dungeon;
5460 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));
5461 if (record_maxdepth)
5463 do_cmd_write_nikki(NIKKI_TRUMP, select_dungeon, "¥È¥é¥ó¥×¥¿¥ï¡¼¤Ç");
5465 do_cmd_write_nikki(NIKKI_TRUMP, select_dungeon, "at Trump Tower");
5468 msg_print("²ó¤ê¤ÎÂ絤¤¬Ä¥¤ê¤Ä¤á¤Æ¤¤¿...");
5470 msg_print("The air about you becomes charged...");
5474 p_ptr->redraw |= (PR_STATUS);
5478 case BACT_LOSE_MUTATION:
5479 if (p_ptr->muta1 || p_ptr->muta2 ||
5480 (p_ptr->muta3 & ~MUT3_GOOD_LUCK) ||
5481 (p_ptr->pseikaku != SEIKAKU_LUCKY &&
5482 (p_ptr->muta3 & MUT3_GOOD_LUCK)))
5484 while(!lose_mutation(0));
5490 msg_print("¼£¤¹¤Ù¤ÆÍÁ³ÊÑ°Û¤¬Ìµ¤¤¡£");
5492 msg_print("You have no mutations.");
5500 case BACT_TSUCHINOKO:
5514 msg_print("Ê¿¹Õ²½¤Îµ·¼°¤ò¹Ô¤Ê¤Ã¤¿¡£");
5516 msg_print("You received an equalization ritual.");
5518 set_virtue(V_COMPASSION, 0);
5519 set_virtue(V_HONOUR, 0);
5520 set_virtue(V_JUSTICE, 0);
5521 set_virtue(V_SACRIFICE, 0);
5522 set_virtue(V_KNOWLEDGE, 0);
5523 set_virtue(V_FAITH, 0);
5524 set_virtue(V_ENLIGHTEN, 0);
5525 set_virtue(V_ENCHANT, 0);
5526 set_virtue(V_CHANCE, 0);
5527 set_virtue(V_NATURE, 0);
5528 set_virtue(V_HARMONY, 0);
5529 set_virtue(V_VITALITY, 0);
5530 set_virtue(V_UNLIFE, 0);
5531 set_virtue(V_PATIENCE, 0);
5532 set_virtue(V_TEMPERANCE, 0);
5533 set_virtue(V_DILIGENCE, 0);
5534 set_virtue(V_VALOUR, 0);
5535 set_virtue(V_INDIVIDUALISM, 0);
5539 case BACT_TELE_TOWN:
5543 paid = eval_ac(p_ptr->dis_ac + p_ptr->dis_to_a);
5545 case BACT_BROKEN_WEAPON:
5547 bcost = repair_broken_weapon(bcost);
5561 void do_cmd_quest(void)
5565 if (!cave_have_flag_bold(py, px, FF_QUEST_ENTER))
5568 msg_print("¤³¤³¤Ë¤Ï¥¯¥¨¥¹¥È¤ÎÆþ¸ý¤Ï¤Ê¤¤¡£");
5570 msg_print("You see no quest level here.");
5578 msg_print("¤³¤³¤Ë¤Ï¥¯¥¨¥¹¥È¤Ø¤ÎÆþ¸ý¤¬¤¢¤ê¤Þ¤¹¡£");
5579 if (!get_check("¥¯¥¨¥¹¥È¤ËÆþ¤ê¤Þ¤¹¤«¡©")) return;
5580 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
5581 msg_print("¡Ø¤È¤Ë¤«¤¯Æþ¤Ã¤Æ¤ß¤è¤¦¤¼¤§¡£¡Ù");
5583 msg_print("There is an entry of a quest.");
5584 if (!get_check("Do you enter? ")) return;
5587 /* Player enters a new quest */
5591 leave_quest_check();
5593 if (quest[p_ptr->inside_quest].type != QUEST_TYPE_RANDOM) dun_level = 1;
5594 p_ptr->inside_quest = cave[py][px].special;
5596 p_ptr->leaving = TRUE;
5602 * Do building commands
5604 void do_cmd_bldg(void)
5609 building_type *bldg;
5614 if (!cave_have_flag_bold(py, px, FF_BLDG))
5617 msg_print("¤³¤³¤Ë¤Ï·úʪ¤Ï¤Ê¤¤¡£");
5619 msg_print("You see no building here.");
5625 which = f_info[cave[py][px].feat].subtype;
5627 bldg = &building[which];
5629 /* Don't re-init the wilderness */
5630 reinit_wilderness = FALSE;
5632 if ((which == 2) && (p_ptr->arena_number < 0))
5635 msg_print("¡ÖÇÔ¼Ô¤ËÍѤϤʤ¤¡£¡×");
5637 msg_print("'There's no place here for a LOSER like you!'");
5641 else if ((which == 2) && p_ptr->inside_arena)
5643 if (!p_ptr->exit_bldg && m_cnt > 0)
5646 prt("¥²¡¼¥È¤ÏÊĤޤäƤ¤¤ë¡£¥â¥ó¥¹¥¿¡¼¤¬¤¢¤Ê¤¿¤òÂԤäƤ¤¤ë¡ª", 0, 0);
5648 prt("The gates are closed. The monster awaits!", 0, 0);
5653 /* Don't save the arena as saved floor */
5654 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_NO_RETURN);
5656 p_ptr->inside_arena = FALSE;
5657 p_ptr->leaving = TRUE;
5659 /* Re-enter the arena */
5660 command_new = SPECIAL_KEY_BUILDING;
5662 /* No energy needed to re-enter the arena */
5668 else if (p_ptr->inside_battle)
5670 /* Don't save the arena as saved floor */
5671 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_NO_RETURN);
5673 p_ptr->leaving = TRUE;
5674 p_ptr->inside_battle = FALSE;
5676 /* Re-enter the monster arena */
5677 command_new = SPECIAL_KEY_BUILDING;
5679 /* No energy needed to re-enter the arena */
5690 /* Forget the lite */
5693 /* Forget the view */
5696 /* Hack -- Increase "icky" depth */
5703 show_building(bldg);
5711 building_prt_gold();
5715 if (command == ESCAPE)
5718 p_ptr->inside_arena = FALSE;
5719 p_ptr->inside_battle = FALSE;
5723 for (i = 0; i < 8; i++)
5725 if (bldg->letters[i])
5727 if (bldg->letters[i] == command)
5736 bldg_process_command(bldg, i);
5745 /* Flush messages XXX XXX XXX */
5749 /* Reinit wilderness to activate quests ... */
5750 if (reinit_wilderness)
5752 p_ptr->leaving = TRUE;
5755 /* Hack -- Decrease "icky" depth */
5758 /* Clear the screen */
5761 /* Update the visuals */
5762 p_ptr->update |= (PU_VIEW | PU_MONSTERS | PU_BONUS | PU_LITE | PU_MON_LITE);
5764 /* Redraw entire screen */
5765 p_ptr->redraw |= (PR_BASIC | PR_EXTRA | PR_EQUIPPY | PR_MAP);
5768 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
5772 /* Array of places to find an inscription */
5773 static cptr find_quest[] =
5776 "¾²¤Ë¥á¥Ã¥»¡¼¥¸¤¬¹ï¤Þ¤ì¤Æ¤¤¤ë:",
5778 "You find the following inscription in the floor",
5782 "Êɤ˥á¥Ã¥»¡¼¥¸¤¬¹ï¤Þ¤ì¤Æ¤¤¤ë:",
5784 "You see a message inscribed in the wall",
5788 "¥á¥Ã¥»¡¼¥¸¤ò¸«¤Ä¤±¤¿:",
5790 "There is a sign saying",
5794 "²¿¤«¤¬³¬Ãʤξå¤Ë½ñ¤¤¤Æ¤¢¤ë:",
5796 "Something is written on the staircase",
5800 "´¬Êª¤ò¸«¤Ä¤±¤¿¡£¥á¥Ã¥»¡¼¥¸¤¬½ñ¤¤¤Æ¤¢¤ë:",
5802 "You find a scroll with the following message",
5811 void quest_discovery(int q_idx)
5813 quest_type *q_ptr = &quest[q_idx];
5814 monster_race *r_ptr = &r_info[q_ptr->r_idx];
5815 int q_num = q_ptr->max_num;
5818 /* No quest index */
5821 strcpy(name, (r_name + r_ptr->name));
5823 msg_print(find_quest[rand_range(0, 4)]);
5830 /* Hack -- "unique" monsters must be "unique" */
5831 if ((r_ptr->flags1 & RF1_UNIQUE) &&
5832 (0 == r_ptr->max_num))
5835 msg_print("¤³¤Î³¬¤Ï°ÊÁ°¤Ï狼¤Ë¤è¤Ã¤Æ¼é¤é¤ì¤Æ¤¤¤¿¤è¤¦¤À¡Ä¡£");
5837 msg_print("It seems that this level was protected by someone before...");
5839 /* The unique is already dead */
5840 quest[q_idx].status = QUEST_STATUS_FINISHED;
5843 q_ptr->comptime = playtime;
5848 msg_format("Ãí°Õ¤»¤è¡ª¤³¤Î³¬¤Ï%s¤Ë¤è¤Ã¤Æ¼é¤é¤ì¤Æ¤¤¤ë¡ª", name);
5850 msg_format("Beware, this level is protected by %s!", name);
5856 /* Normal monsters */
5858 msg_format("Ãí°Õ¤·¤í¡ª¤³¤Î³¬¤Ï%dÂΤÎ%s¤Ë¤è¤Ã¤Æ¼é¤é¤ì¤Æ¤¤¤ë¡ª", q_num, name);
5861 msg_format("Be warned, this level is guarded by %d %s!", q_num, name);
5869 * Hack -- Check if a level is a "quest" level
5871 int quest_number(int level)
5876 if (p_ptr->inside_quest)
5877 return (p_ptr->inside_quest);
5879 for (i = 0; i < max_quests; i++)
5881 if (quest[i].status != QUEST_STATUS_TAKEN) continue;
5883 if ((quest[i].type == QUEST_TYPE_KILL_LEVEL) &&
5884 !(quest[i].flags & QUEST_FLAG_PRESET) &&
5885 (quest[i].level == level) &&
5886 (quest[i].dungeon == dungeon_type))
5890 /* Check for random quest */
5891 return (random_quest_number(level));
5896 * Return the index of the random quest on this level
5899 int random_quest_number(int level)
5903 if (dungeon_type != DUNGEON_ANGBAND) return 0;
5905 for (i = MIN_RANDOM_QUEST; i < MAX_RANDOM_QUEST + 1; i++)
5907 if ((quest[i].type == QUEST_TYPE_RANDOM) &&
5908 (quest[i].status == QUEST_STATUS_TAKEN) &&
5909 (quest[i].level == level) &&
5910 (quest[i].dungeon == DUNGEON_ANGBAND))