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 ½ê»ý¶â¤òɽ¼¨¤¹¤ë¡£
111 static void building_prt_gold(void)
116 prt("¼ê»ý¤Á¤Î¤ª¶â: ", 23,53);
118 prt("Gold Remaining: ", 23, 53);
122 sprintf(tmp_str, "%9ld", (long)p_ptr->au);
123 prt(tmp_str, 23, 68);
127 * @brief »ÜÀߤΥµ¡¼¥Ó¥¹°ìÍ÷¤òɽ¼¨¤¹¤ë / Display a building.
128 * @param bldg »ÜÀß¹½Â¤ÂΤλ²¾È¥Ý¥¤¥ó¥¿
131 static void show_building(building_type* bldg)
139 sprintf(tmp_str, "%s (%s) %35s", bldg->owner_name, bldg->owner_race, bldg->name);
143 for (i = 0; i < 8; i++)
145 if (bldg->letters[i])
147 if (bldg->action_restr[i] == 0)
149 if ((is_owner(bldg) && (bldg->member_costs[i] == 0)) ||
150 (!is_owner(bldg) && (bldg->other_costs[i] == 0)))
152 action_color = TERM_WHITE;
155 else if (is_owner(bldg))
157 action_color = TERM_YELLOW;
159 sprintf(buff, "($%ld)", (long int)bldg->member_costs[i]);
161 sprintf(buff, "(%ldgp)", (long int)bldg->member_costs[i]);
167 action_color = TERM_YELLOW;
169 sprintf(buff, "($%ld)", (long int)bldg->other_costs[i]);
171 sprintf(buff, "(%ldgp)", (long int)bldg->other_costs[i]);
176 else if (bldg->action_restr[i] == 1)
178 if (!is_member(bldg))
180 action_color = TERM_L_DARK;
182 strcpy(buff, "(ÊÄŹ)");
184 strcpy(buff, "(closed)");
188 else if ((is_owner(bldg) && (bldg->member_costs[i] == 0)) ||
189 (is_member(bldg) && (bldg->other_costs[i] == 0)))
191 action_color = TERM_WHITE;
194 else if (is_owner(bldg))
196 action_color = TERM_YELLOW;
198 sprintf(buff, "($%ld)", (long int)bldg->member_costs[i]);
200 sprintf(buff, "(%ldgp)", (long int)bldg->member_costs[i]);
206 action_color = TERM_YELLOW;
208 sprintf(buff, "($%ld)", (long int)bldg->other_costs[i]);
210 sprintf(buff, "(%ldgp)", (long int)bldg->other_costs[i]);
219 action_color = TERM_L_DARK;
221 strcpy(buff, "(ÊÄŹ)");
223 strcpy(buff, "(closed)");
227 else if (bldg->member_costs[i] != 0)
229 action_color = TERM_YELLOW;
231 sprintf(buff, "($%ld)", (long int)bldg->member_costs[i]);
233 sprintf(buff, "(%ldgp)", (long int)bldg->member_costs[i]);
239 action_color = TERM_WHITE;
244 sprintf(tmp_str," %c) %s %s", bldg->letters[i], bldg->act_names[i], buff);
245 c_put_str(action_color, tmp_str, 19+(i/2), 35*(i%2));
250 prt(" ESC) ·úʪ¤ò½Ð¤ë", 23, 0);
252 prt(" ESC) Exit building", 23, 0);
258 * @brief Æ®µ»¾ì¤ËÆþ¤ë¥³¥Þ¥ó¥É¤Î½èÍý / arena commands
259 * @param cmd Æ®µ»¾ì½èÍý¤ÎID
262 static void arena_comm(int cmd)
271 if (p_ptr->arena_number == MAX_ARENA_MONS)
275 prt("¥¢¥ê¡¼¥Ê¤ÎÍ¥¾¡¼Ô¡ª", 5, 0);
276 prt("¤ª¤á¤Ç¤È¤¦¡ª¤¢¤Ê¤¿¤ÏÁ´¤Æ¤ÎŨ¤òÅݤ·¤Þ¤·¤¿¡£", 7, 0);
277 prt("¾Þ¶â¤È¤·¤Æ $1,000,000 ¤¬Í¿¤¨¤é¤ì¤Þ¤¹¡£", 8, 0);
279 prt(" Arena Victor!", 5, 0);
280 prt("Congratulations! You have defeated all before you.", 7, 0);
281 prt("For that, receive the prize: 1,000,000 gold pieces", 8, 0);
286 p_ptr->au += 1000000L;
288 msg_print("¥¹¥Ú¡¼¥¹¥¡¼¤Ç³¹Ô");
290 msg_print("Press the space bar to continue");
294 p_ptr->arena_number++;
296 else if (p_ptr->arena_number > MAX_ARENA_MONS)
298 if (p_ptr->arena_number < MAX_ARENA_MONS+2)
301 msg_print("·¯¤Î¤¿¤á¤ËºÇ¶¯¤ÎÄ©Àï¼Ô¤òÍÑ°Õ¤·¤Æ¤ª¤¤¤¿¡£");
303 msg_print("The strongest challenger is waiting for you.");
308 if (get_check("Ä©À魯¤ë¤«¤Í¡©"))
310 if (get_check("Do you fight? "))
314 msg_print("»à¤Ì¤¬¤è¤¤¡£");
316 msg_print("Die, maggots.");
320 p_ptr->exit_bldg = FALSE;
323 /* Save the surface floor as saved floor */
324 prepare_change_floor_mode(CFM_SAVE_FLOORS);
326 p_ptr->inside_arena = TRUE;
327 p_ptr->leaving = TRUE;
333 msg_print("»ÄÇ°¤À¡£");
335 msg_print("We are disappointed.");
342 msg_print("¤¢¤Ê¤¿¤Ï¥¢¥ê¡¼¥Ê¤ËÆþ¤ê¡¢¤·¤Ð¤é¤¯¤Î´Ö±É¸÷¤Ë¤Ò¤¿¤Ã¤¿¡£");
344 msg_print("You enter the arena briefly and bask in your glory.");
350 else if (p_ptr->riding && (p_ptr->pclass != CLASS_BEASTMASTER) && (p_ptr->pclass != CLASS_CAVALRY))
353 msg_print("¥Ú¥Ã¥È¤Ë¾è¤Ã¤¿¤Þ¤Þ¤Ç¤Ï¥¢¥ê¡¼¥Ê¤ØÆþ¤ì¤µ¤»¤Æ¤â¤é¤¨¤Ê¤«¤Ã¤¿¡£");
355 msg_print("You don't have permission to enter with pet.");
362 p_ptr->exit_bldg = FALSE;
365 /* Save the surface floor as saved floor */
366 prepare_change_floor_mode(CFM_SAVE_FLOORS);
368 p_ptr->inside_arena = TRUE;
369 p_ptr->leaving = TRUE;
374 if (p_ptr->arena_number == MAX_ARENA_MONS)
376 msg_print("¤¢¤Ê¤¿¤Ï¾¡Íø¼Ô¤À¡£ ¥¢¥ê¡¼¥Ê¤Ç¤Î¥»¥ì¥â¥Ë¡¼¤Ë»²²Ã¤·¤Ê¤µ¤¤¡£");
378 msg_print("You are victorious. Enter the arena for the ceremony.");
381 else if (p_ptr->arena_number > MAX_ARENA_MONS)
384 msg_print("¤¢¤Ê¤¿¤Ï¤¹¤Ù¤Æ¤ÎŨ¤Ë¾¡Íø¤·¤¿¡£");
386 msg_print("You have won against all foes.");
391 r_ptr = &r_info[arena_info[p_ptr->arena_number].r_idx];
392 name = (r_name + r_ptr->name);
394 msg_format("%s ¤ËÄ©À魯¤ë¤â¤Î¤Ï¤¤¤Ê¤¤¤«¡©", name);
396 msg_format("Do I hear any challenges against: %s", name);
400 case BACT_ARENA_RULES:
405 /* Peruse the arena help file */
407 (void)show_file(TRUE, "arena_j.txt", NULL, 0, 0);
409 (void)show_file(TRUE, "arena.txt", NULL, 0, 0);
421 * @brief ¥«¥¸¥Î¤Î¥¹¥í¥Ã¥È¥·¥ó¥Ü¥ë¤òɽ¼¨¤¹¤ë / display fruit for dice slots
422 * @param row ¥·¥ó¥Ü¥ë¤òɽ¼¨¤¹¤ë¹Ô¤Î¾åü
423 * @param col ¥·¥ó¥Ü¥ë¤òɽ¼¨¤¹¤ë¹Ô¤Îº¸Ã¼
424 * @param fruit ɽ¼¨¤¹¤ë¥·¥ó¥Ü¥ëID
427 static void display_fruit(int row, int col, int fruit)
433 c_put_str(TERM_YELLOW, " ####.", row, col);
434 c_put_str(TERM_YELLOW, " # #", row + 1, col);
435 c_put_str(TERM_YELLOW, " # #", row + 2, col);
436 c_put_str(TERM_YELLOW, "# #", row + 3, col);
437 c_put_str(TERM_YELLOW, "# #", row + 4, col);
438 c_put_str(TERM_YELLOW, "# # ", row + 5, col);
439 c_put_str(TERM_YELLOW, "# # ", row + 6, col);
440 c_put_str(TERM_YELLOW, ".#### ", row + 7, col);
441 prt( " ¥ì¥â¥ó ", row + 8, col);
443 c_put_str(TERM_YELLOW, " ####.", row, col);
444 c_put_str(TERM_YELLOW, " # #", row + 1, col);
445 c_put_str(TERM_YELLOW, " # #", row + 2, col);
446 c_put_str(TERM_YELLOW, "# #", row + 3, col);
447 c_put_str(TERM_YELLOW, "# #", row + 4, col);
448 c_put_str(TERM_YELLOW, "# # ", row + 5, col);
449 c_put_str(TERM_YELLOW, "# # ", row + 6, col);
450 c_put_str(TERM_YELLOW, ".#### ", row + 7, col);
451 prt( " Lemon ", row + 8, col);
457 c_put_str(TERM_ORANGE, " ## ", row, col);
458 c_put_str(TERM_ORANGE, " #..# ", row + 1, col);
459 c_put_str(TERM_ORANGE, " #....# ", row + 2, col);
460 c_put_str(TERM_ORANGE, "#......#", row + 3, col);
461 c_put_str(TERM_ORANGE, "#......#", row + 4, col);
462 c_put_str(TERM_ORANGE, " #....# ", row + 5, col);
463 c_put_str(TERM_ORANGE, " #..# ", row + 6, col);
464 c_put_str(TERM_ORANGE, " ## ", row + 7, col);
465 prt( "¥ª¥ì¥ó¥¸", row + 8, col);
467 c_put_str(TERM_ORANGE, " ## ", row, col);
468 c_put_str(TERM_ORANGE, " #..# ", row + 1, col);
469 c_put_str(TERM_ORANGE, " #....# ", row + 2, col);
470 c_put_str(TERM_ORANGE, "#......#", row + 3, col);
471 c_put_str(TERM_ORANGE, "#......#", row + 4, col);
472 c_put_str(TERM_ORANGE, " #....# ", row + 5, col);
473 c_put_str(TERM_ORANGE, " #..# ", row + 6, col);
474 c_put_str(TERM_ORANGE, " ## ", row + 7, col);
475 prt( " Orange ", row + 8, col);
481 c_put_str(TERM_SLATE, " ¦« " , row, col);
482 c_put_str(TERM_SLATE, " || " , row + 1, col);
483 c_put_str(TERM_SLATE, " || " , row + 2, col);
484 c_put_str(TERM_SLATE, " || " , row + 3, col);
485 c_put_str(TERM_SLATE, " || " , row + 4, col);
486 c_put_str(TERM_SLATE, " || " , row + 5, col);
487 c_put_str(TERM_UMBER, " |=°¡=| " , row + 6, col);
488 c_put_str(TERM_UMBER, " ÌÜ " , row + 7, col);
489 prt( " ·õ " , row + 8, col);
491 c_put_str(TERM_SLATE, " /\\ " , row, col);
492 c_put_str(TERM_SLATE, " ## " , row + 1, col);
493 c_put_str(TERM_SLATE, " ## " , row + 2, col);
494 c_put_str(TERM_SLATE, " ## " , row + 3, col);
495 c_put_str(TERM_SLATE, " ## " , row + 4, col);
496 c_put_str(TERM_SLATE, " ## " , row + 5, col);
497 c_put_str(TERM_UMBER, " ###### " , row + 6, col);
498 c_put_str(TERM_UMBER, " ## " , row + 7, col);
499 prt( " Sword " , row + 8, col);
505 c_put_str(TERM_SLATE, " ###### ", row, col);
506 c_put_str(TERM_SLATE, "# #", row + 1, col);
507 c_put_str(TERM_SLATE, "# ++++ #", row + 2, col);
508 c_put_str(TERM_SLATE, "# +==+ #", row + 3, col);
509 c_put_str(TERM_SLATE, "# ++ #", row + 4, col);
510 c_put_str(TERM_SLATE, " # # ", row + 5, col);
511 c_put_str(TERM_SLATE, " # # ", row + 6, col);
512 c_put_str(TERM_SLATE, " ## ", row + 7, col);
513 prt( " ½â ", row + 8, col);
515 c_put_str(TERM_SLATE, " ###### ", row, col);
516 c_put_str(TERM_SLATE, "# #", row + 1, col);
517 c_put_str(TERM_SLATE, "# ++++ #", row + 2, col);
518 c_put_str(TERM_SLATE, "# +==+ #", row + 3, col);
519 c_put_str(TERM_SLATE, "# ++ #", row + 4, col);
520 c_put_str(TERM_SLATE, " # # ", row + 5, col);
521 c_put_str(TERM_SLATE, " # # ", row + 6, col);
522 c_put_str(TERM_SLATE, " ## ", row + 7, col);
523 prt( " Shield ", row + 8, col);
529 c_put_str(TERM_VIOLET, " ## ", row, col);
530 c_put_str(TERM_VIOLET, " ###### ", row + 1, col);
531 c_put_str(TERM_VIOLET, "########", row + 2, col);
532 c_put_str(TERM_VIOLET, "########", row + 3, col);
533 c_put_str(TERM_VIOLET, "########", row + 4, col);
534 c_put_str(TERM_VIOLET, " ###### ", row + 5, col);
535 c_put_str(TERM_VIOLET, " #### ", row + 6, col);
536 c_put_str(TERM_VIOLET, " ## ", row + 7, col);
537 prt( " ¥×¥é¥à ", row + 8, col);
539 c_put_str(TERM_VIOLET, " ## ", row, col);
540 c_put_str(TERM_VIOLET, " ###### ", row + 1, col);
541 c_put_str(TERM_VIOLET, "########", row + 2, col);
542 c_put_str(TERM_VIOLET, "########", row + 3, col);
543 c_put_str(TERM_VIOLET, "########", row + 4, col);
544 c_put_str(TERM_VIOLET, " ###### ", row + 5, col);
545 c_put_str(TERM_VIOLET, " #### ", row + 6, col);
546 c_put_str(TERM_VIOLET, " ## ", row + 7, col);
547 prt( " Plum ", row + 8, col);
553 c_put_str(TERM_RED, " ##", row, col);
554 c_put_str(TERM_RED, " ### ", row + 1, col);
555 c_put_str(TERM_RED, " #..# ", row + 2, col);
556 c_put_str(TERM_RED, " #..# ", row + 3, col);
557 c_put_str(TERM_RED, " ###### ", row + 4, col);
558 c_put_str(TERM_RED, "#..##..#", row + 5, col);
559 c_put_str(TERM_RED, "#..##..#", row + 6, col);
560 c_put_str(TERM_RED, " ## ## ", row + 7, col);
561 prt( "¥Á¥§¥ê¡¼", row + 8, col);
563 c_put_str(TERM_RED, " ##", row, col);
564 c_put_str(TERM_RED, " ### ", row + 1, col);
565 c_put_str(TERM_RED, " #..# ", row + 2, col);
566 c_put_str(TERM_RED, " #..# ", row + 3, col);
567 c_put_str(TERM_RED, " ###### ", row + 4, col);
568 c_put_str(TERM_RED, "#..##..#", row + 5, col);
569 c_put_str(TERM_RED, "#..##..#", row + 6, col);
570 c_put_str(TERM_RED, " ## ## ", row + 7, col);
571 prt( " Cherry ", row + 8, col);
579 * kpoker no (tyuto-hannpa na)pakuri desu...
580 * joker ha shineru node haitte masen.
582 * TODO: donataka! tsukutte!
583 * - agatta yaku no kiroku (like DQ).
584 * - kakkoii card no e.
585 * - sousa-sei no koujyo.
586 * - code wo wakariyasuku.
588 * - Joker... -- done.
591 * 9/15/2000 joker wo jissou. soreto, code wo sukosi kakikae. --Habu
594 #define SUIT_OF(card) ((card) / 13) /*!< ¥È¥é¥ó¥×¥«¡¼¥É¤Î¥¹¡¼¥È¤òÊÖ¤¹ */
595 #define NUM_OF(card) ((card) % 13) /*!< ¥È¥é¥ó¥×¥«¡¼¥É¤ÎÈÖ¹æ¤òÊÖ¤¹ */
596 #define IS_JOKER(card) ((card) == 52) /*!< ¥È¥é¥ó¥×¥«¡¼¥É¤¬¥¸¥ç¡¼¥«¡¼¤«¤É¤¦¤«¤òÊÖ¤¹ */
598 static int cards[5]; /*!< ¥Ý¡¼¥«¡¼¤Î¸½ºß¤Î¼ê»¥ID */
601 * @brief ¥Ý¡¼¥«¡¼¤Î»³»¥¤òÀڤ롣
602 * @param deck ¥Ç¥Ã¥¤ÎÇÛÎó
605 static void reset_deck(int deck[])
608 for (i = 0; i < 53; i++) deck[i] = i;
611 for (i = 0; i < 53; i++){
612 int tmp1 = randint0(53 - i) + i;
614 deck[i] = deck[tmp1];
620 * @brief ¥Ý¡¼¥«¡¼¥×¥ì¥¤Ãæ¤Ë¥¸¥ç¡¼¥«¡¼¤ò»ý¤Ã¤Æ¤¤¤ë¤«¤ÎȽÄê¤òÊÖ¤¹¡£
621 * @return ¥¸¥ç¡¼¥«¡¼¤ò»ý¤Ã¤Æ¤¤¤ë¤«¡£
623 static bool have_joker(void)
627 for (i = 0; i < 5; i++){
628 if(IS_JOKER(cards[i])) return TRUE;
634 * @brief ¥Ý¡¼¥«¡¼¤Î¼ê»¥¤Ë³ºÅö¤ÎÈÖ¹æ¤Î»¥¤¬¤¢¤ë¤«¤òÊÖ¤¹¡£
635 * @param num õ¤·¤¿¤¤¥«¡¼¥É¤ÎÈֹ档
636 * @return ³ºÅö¤ÎÈֹ椬¼ê»¥¤Ë¤¢¤ë¤«¡£
638 static bool find_card_num(int num)
641 for (i = 0; i < 5; i++)
642 if (NUM_OF(cards[i]) == num && !IS_JOKER(cards[i])) return TRUE;
647 * @brief ¥Ý¡¼¥«¡¼¤Î¼ê»¥¤¬¥Õ¥é¥Ã¥·¥åÌò¤òÆÀ¤Æ¤¤¤ë¤«¤òµ¢¤¹¡£
648 * @return Ìò¤ÎȽÄê·ë²Ì
650 static bool yaku_check_flush(void)
653 bool joker_is_used = FALSE;
655 suit = IS_JOKER(cards[0]) ? SUIT_OF(cards[1]) : SUIT_OF(cards[0]);
656 for (i = 0; i < 5; i++){
657 if (SUIT_OF(cards[i]) != suit){
658 if(have_joker() && !joker_is_used)
659 joker_is_used = TRUE;
669 * @brief ¥Ý¡¼¥«¡¼¤Î¼ê»¥¤¬¥¹¥È¥ì¡¼¥ÈÌò¤òÆÀ¤Æ¤¤¤ë¤«¤òµ¢¤¹¡£
670 * @return Ìò¤ÎȽÄê·ë²Ì
672 static int yaku_check_straight(void)
675 bool joker_is_used = FALSE;
678 for (i = 0; i < 5; i++)
680 if (NUM_OF(cards[i]) < lowest && !IS_JOKER(cards[i]))
681 lowest = NUM_OF(cards[i]);
684 if (yaku_check_flush())
687 for (i = 0; i < 4; i++)
689 if (!find_card_num(9 + i)){
690 if( have_joker() && !joker_is_used )
691 joker_is_used = TRUE;
696 if (i == 4) return 3; /* Wow! Royal Flush!!! */
699 for (i = 0; i < 3; i++)
701 if (!find_card_num(10 + i))
704 if (i == 3 && have_joker()) return 3; /* Wow! Royal Flush!!! */
708 joker_is_used = FALSE;
709 for (i = 0; i < 5; i++)
711 if (!find_card_num(lowest + i)){
712 if( have_joker() && !joker_is_used )
713 joker_is_used = TRUE;
719 if (yaku_check_flush())
720 return 2; /* Straight Flush */
726 * @brief ¥Ý¡¼¥«¡¼¤Î¥Ú¥¢Ìò¤Î¾õÂÖ¤òÊÖ¤¹¡£
727 * @return 0:nopair 1:1 pair 2:2 pair 3:3 cards 4:full house 6:4cards
729 static int yaku_check_pair(void)
731 int i, i2, matching = 0;
733 for (i = 0; i < 5; i++)
735 for (i2 = i+1; i2 < 5; i2++)
737 if (IS_JOKER(cards[i]) || IS_JOKER(cards[i2])) continue;
738 if (NUM_OF(cards[i]) == NUM_OF(cards[i2]))
769 #define ODDS_5A 3000 /*!< ¥Õ¥¡¥¤¥Ö¥¨¡¼¥¹¤ÎÌòÇÜΨ */
770 #define ODDS_5C 400 /*!< ¥Õ¥¡¥¤¥Ö¥«¡¼¥É¤ÎÌòÇÜΨ */
771 #define ODDS_RF 200 /*!< ¥í¥¤¥ä¥ë¥¹¥È¥ì¡¼¥È¥Õ¥é¥Ã¥·¥å¤ÎÌòÇÜΨ */
772 #define ODDS_SF 80 /*!< ¥¹¥È¥ì¡¼¥È¥Õ¥é¥Ã¥·¥å¤ÎÌòÇÜΨ */
773 #define ODDS_4C 16 /*!< ¥Õ¥©¥¢¥«¡¼¥É¤ÎÌòÇÜΨ */
774 #define ODDS_FH 12 /*!< ¥Õ¥ë¥Ï¥¦¥¹¤ÎÌòÇÜΨ */
775 #define ODDS_FL 8 /*!< ¥Õ¥é¥Ã¥·¥å¤ÎÌòÇÜΨ */
776 #define ODDS_ST 4 /*!< ¥¹¥È¥ì¡¼¥È¤ÎÌòÇÜΨ */
777 #define ODDS_3C 1 /*!< ¥¹¥ê¡¼¥«¡¼¥É¤ÎÌòÇÜΨ */
778 #define ODDS_2P 1 /*!< ¥Ä¡¼¥Ú¥¢¤ÎÌòÇÜΨ */
781 * @brief ¥Ý¡¼¥«¡¼¤ÎÌò¤ò¥Á¥§¥Ã¥¯¤·¡¢¤½¤Î·ë²Ì¤ò²èÌ̤Ëɽ¼¨¤·¤Ä¤Ä·ë²Ì¤òÊÖ¤¹¡£
784 static int yaku_check(void)
788 switch(yaku_check_straight()){
791 c_put_str(TERM_YELLOW, "¥í¥¤¥ä¥ë¥¹¥È¥ì¡¼¥È¥Õ¥é¥Ã¥·¥å", 4, 3);
793 c_put_str(TERM_YELLOW, "Royal Flush", 4, 3);
798 c_put_str(TERM_YELLOW, "¥¹¥È¥ì¡¼¥È¥Õ¥é¥Ã¥·¥å", 4, 3);
800 c_put_str(TERM_YELLOW, "Straight Flush", 4, 3);
805 c_put_str(TERM_YELLOW, "¥¹¥È¥ì¡¼¥È", 4, 3);
807 c_put_str(TERM_YELLOW, "Straight", 4, 3);
811 /* Not straight -- fall through */
815 if (yaku_check_flush())
819 c_put_str(TERM_YELLOW, "¥Õ¥é¥Ã¥·¥å", 4, 3);
821 c_put_str(TERM_YELLOW, "Flush", 4, 3);
826 switch (yaku_check_pair())
830 c_put_str(TERM_YELLOW, "¥ï¥ó¥Ú¥¢", 4, 3);
832 c_put_str(TERM_YELLOW, "One pair", 4, 3);
837 c_put_str(TERM_YELLOW, "¥Ä¡¼¥Ú¥¢", 4, 3);
839 c_put_str(TERM_YELLOW, "Two pair", 4, 3);
844 c_put_str(TERM_YELLOW, "¥¹¥ê¡¼¥«¡¼¥É", 4, 3);
846 c_put_str(TERM_YELLOW, "Three of a kind", 4, 3);
851 c_put_str(TERM_YELLOW, "¥Õ¥ë¥Ï¥¦¥¹", 4, 3);
853 c_put_str(TERM_YELLOW, "Full house", 4, 3);
858 c_put_str(TERM_YELLOW, "¥Õ¥©¡¼¥«¡¼¥É", 4, 3);
860 c_put_str(TERM_YELLOW, "Four of a kind", 4, 3);
864 if (!NUM_OF(cards[0]) || !NUM_OF(cards[1]))
867 c_put_str(TERM_YELLOW, "¥Õ¥¡¥¤¥Ö¥¨¡¼¥¹", 4, 3);
869 c_put_str(TERM_YELLOW, "Five ace", 4, 3);
876 c_put_str(TERM_YELLOW, "¥Õ¥¡¥¤¥Ö¥«¡¼¥É", 4, 3);
878 c_put_str(TERM_YELLOW, "Five of a kind", 4, 3);
889 * @brief ¥Ý¡¼¥«¡¼¤Î¼Î¤Æ¤ë/»Ä¤¹¥¤¥ó¥¿¡¼¥Õ¥§¥¤¥¹¤Îɽ¼¨¤ò¹¹¿·¤¹¤ë¡£
890 * @param hoge ¥«¡¼¥½¥ë¤Î¸½ºß°ÌÃÖ
891 * @param kaeruka ¥«¡¼¥É¤Î¼Î¤Æ¤ë/»Ä¤¹¥Õ¥é¥°ÇÛÎó
894 static void display_kaeruka(int hoge, int kaeruka[])
897 char col = TERM_WHITE;
898 for (i = 0; i < 5; i++)
900 if (i == hoge) col = TERM_YELLOW;
901 else if(kaeruka[i]) col = TERM_WHITE;
902 else col = TERM_L_BLUE;
905 c_put_str(col, "¤«¤¨¤ë", 14, 5+i*16);
907 c_put_str(col, "¤Î¤³¤¹", 14, 5+i*16);
910 c_put_str(col, "Change", 14, 5+i*16);
912 c_put_str(col, " Stay ", 14, 5+i*16);
915 if (hoge > 4) col = TERM_YELLOW;
916 else col = TERM_WHITE;
918 c_put_str(col, "·èÄê", 16, 38);
920 c_put_str(col, "Sure", 16, 38);
923 /* Hilite current option */
924 if (hoge < 5) move_cursor(14, 5+hoge*16);
925 else move_cursor(16, 38);
929 * @brief ¥Ý¡¼¥«¡¼¤Î¼ê»¥¤òɽ¼¨¤¹¤ë¡£
932 static void display_cards(void)
935 char suitcolor[4] = {TERM_YELLOW, TERM_L_RED, TERM_L_BLUE, TERM_L_GREEN};
937 cptr suit[4] = {"¡ú", "¡ü", "¢ù", "¢÷"};
938 cptr card_grph[13][7] = {{"£Á %s ",
1029 cptr joker_grph[7] = { " ",
1039 cptr suit[4] = {"[]", "qp", "<>", "db"};
1040 cptr card_grph[13][7] = {{"A %s ",
1131 cptr joker_grph[7] = { " ",
1140 for (i = 0; i < 5; i++)
1143 prt("¨®¨¬¨¬¨¬¨¬¨¬¨¬¨¯", 5, i*16);
1145 prt(" +------------+ ", 5, i*16);
1149 for (i = 0; i < 5; i++)
1151 for (j = 0; j < 7; j++)
1154 prt("¨", j+6, i*16);
1156 prt(" |", j+6, i*16);
1158 if(IS_JOKER(cards[i]))
1159 c_put_str(TERM_VIOLET, joker_grph[j], j+6, 2+i*16);
1161 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);
1163 prt("¨", j+6, i*16+14);
1165 prt("| ", j+6, i*16+14);
1169 for (i = 0; i < 5; i++)
1172 prt("¨±¨¬¨¬¨¬¨¬¨¬¨¬¨°", 13, i*16);
1174 prt(" +------------+ ", 13, i*16);
1180 * @brief ¥Ý¡¼¥«¡¼¤Î£±¥×¥ì¥¤¥ë¡¼¥Á¥ó¡£
1181 * @return £±¥×¥ì¥¤¤ÎÌò¤Î·ë²Ì
1183 static int do_poker(void)
1187 int deck[53]; /* yamafuda : 0...52 */
1189 int kaeruka[5]; /* 0:kaenai 1:kaeru */
1193 bool kakikae = TRUE;
1197 for (i = 0; i < 5; i++)
1199 cards[i] = deck[deck_ptr++];
1200 kaeruka[i] = 0; /* default:nokosu */
1220 /* debug:Four Cards */
1222 cards[1] = 0 + 13 * 1;
1223 cards[2] = 0 + 13 * 2;
1224 cards[3] = 0 + 13 * 3;
1228 /* debug:Straight */
1244 /* suteruno wo kimeru */
1246 prt("»Ä¤¹¥«¡¼¥É¤ò·è¤á¤Æ²¼¤µ¤¤(Êý¸þ¤Ç°ÜÆ°, ¥¹¥Ú¡¼¥¹¤ÇÁªÂò)¡£", 0, 0);
1248 prt("Stay witch? ", 0, 0);
1256 if (kakikae) display_kaeruka(k+kettei*5, kaeruka);
1261 case '6': case 'l': case 'L': case KTRL('F'):
1262 if (!kettei) k = (k+1)%5;
1263 else {k = 0;kettei = FALSE;}
1266 case '4': case 'h': case 'H': case KTRL('B'):
1267 if (!kettei) k = (k+4)%5;
1268 else {k = 4;kettei = FALSE;}
1271 case '2': case 'j': case 'J': case KTRL('N'):
1272 if (!kettei) {kettei = TRUE;kakikae = TRUE;}
1274 case '8': case 'k': case 'K': case KTRL('P'):
1275 if (kettei) {kettei = FALSE;kakikae = TRUE;}
1277 case ' ': case '\r':
1278 if (kettei) done = TRUE;
1279 else {kaeruka[k] = !kaeruka[k];kakikae = TRUE;}
1288 for (i = 0; i < 5; i++)
1289 if (kaeruka[i] == 1) cards[i] = deck[deck_ptr++]; /* soshite toru */
1293 return yaku_check();
1298 /* end of poker codes --Koka */
1301 * @brief ¥«¥¸¥Î£±¥×¥ì¥¤¤´¤È¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó / gamble_comm
1302 * @param cmd ¥×¥ì¥¤¤¹¤ë¥²¡¼¥àID
1305 static bool gamble_comm(int cmd)
1308 int roll1, roll2, roll3, choice, odds, win;
1313 char out_val[160], tmp_str[80], again;
1318 if (cmd == BACT_GAMBLE_RULES)
1320 /* Peruse the gambling help file */
1322 (void)show_file(TRUE, "jgambling.txt", NULL, 0, 0);
1324 (void)show_file(TRUE, "gambling.txt", NULL, 0, 0);
1334 msg_print("¤ª¤¤¡ª¤ª¤Þ¤¨°ìʸ¤Ê¤·¤¸¤ã¤Ê¤¤¤«¡ª¤³¤Ã¤«¤é½Ð¤Æ¤¤¤±¡ª");
1336 msg_print("Hey! You don't have gold - get out of here!");
1346 maxbet = p_ptr->lev * 200;
1348 /* We can't bet more than we have */
1349 maxbet = MIN(maxbet, p_ptr->au);
1352 strcpy(out_val, "");
1354 sprintf(tmp_str,"ÅÒ¤±¶â (1-%ld)¡©", (long int)maxbet);
1356 sprintf(tmp_str,"Your wager (1-%ld) ? ", (long int)maxbet);
1361 * Use get_string() because we may need more than
1362 * the s16b value returned by get_quantity().
1364 if (get_string(tmp_str, out_val, 32))
1367 for (p = out_val; *p == ' '; p++);
1372 if (wager > p_ptr->au)
1375 msg_print("¤ª¤¤¡ª¶â¤¬Â¤ê¤Ê¤¤¤¸¤ã¤Ê¤¤¤«¡ª½Ð¤Æ¤¤¤±¡ª");
1377 msg_print("Hey! You don't have the gold - get out of here!");
1384 else if (wager > maxbet)
1387 msg_format("%ld¥´¡¼¥ë¥É¤À¤±¼õ¤±¤è¤¦¡£»Ä¤ê¤Ï¼è¤Ã¤È¤¤Ê¡£", (long int)maxbet);
1389 msg_format("I'll take %ld gold of that. Keep the rest.", (long int)maxbet);
1397 msg_print("£Ï£Ë¡¢£±¥´¡¼¥ë¥É¤«¤é¤Ï¤¸¤á¤è¤¦¡£");
1399 msg_print("Ok, we'll start with 1 gold.");
1408 oldgold = p_ptr->au;
1411 sprintf(tmp_str, "¥²¡¼¥àÁ°¤Î½ê»ý¶â: %9ld", (long int)oldgold);
1413 sprintf(tmp_str, "Gold before game: %9ld", (long int)oldgold);
1416 prt(tmp_str, 20, 2);
1419 sprintf(tmp_str, "¸½ºß¤Î³Ý¤±¶â: %9ld", (long int)wager);
1421 sprintf(tmp_str, "Current Wager: %9ld", (long int)wager);
1424 prt(tmp_str, 21, 2);
1431 case BACT_IN_BETWEEN: /* Game of In-Between */
1433 c_put_str(TERM_GREEN, "¥¤¥ó¡¦¥Ó¥È¥¤¡¼¥ó",5,2);
1435 c_put_str(TERM_GREEN, "In Between", 5, 2);
1440 roll1 = randint1(10);
1441 roll2 = randint1(10);
1442 choice = randint1(10);
1444 sprintf(tmp_str, "¹õ¥À¥¤¥¹: %d ¹õ¥À¥¤¥¹: %d", roll1, roll2);
1446 sprintf(tmp_str, "Black die: %d Black Die: %d", roll1, roll2);
1451 sprintf(tmp_str, "ÀÖ¥À¥¤¥¹: %d", choice);
1453 sprintf(tmp_str, "Red die: %d", choice);
1456 prt(tmp_str, 11, 14);
1457 if (((choice > roll1) && (choice < roll2)) ||
1458 ((choice < roll1) && (choice > roll2)))
1461 case BACT_CRAPS: /* Game of Craps */
1463 c_put_str(TERM_GREEN, "¥¯¥é¥Ã¥×¥¹", 5, 2);
1465 c_put_str(TERM_GREEN, "Craps", 5, 2);
1470 roll1 = randint1(6);
1471 roll2 = randint1(6);
1472 roll3 = roll1 + roll2;
1475 sprintf(tmp_str, "£±¿¶¤ê¤á: %d %d Total: %d", roll1,
1477 sprintf(tmp_str, "First roll: %d %d Total: %d", roll1,
1482 if ((roll3 == 7) || (roll3 == 11))
1484 else if ((roll3 == 2) || (roll3 == 3) || (roll3 == 12))
1490 msg_print("¤Ê¤Ë¤«¥¡¼¤ò²¡¤¹¤È¤â¤¦°ì²ó¿¶¤ê¤Þ¤¹¡£");
1492 msg_print("Hit any key to roll again");
1496 roll1 = randint1(6);
1497 roll2 = randint1(6);
1498 roll3 = roll1 + roll2;
1501 sprintf(tmp_str, "½ÐÌÜ: %d %d ¹ç·×: %d",
1503 sprintf(tmp_str, "Roll result: %d %d Total: %d",
1506 roll1, roll2, roll3);
1508 if (roll3 == choice)
1510 else if (roll3 == 7)
1512 } while ((win != TRUE) && (win != FALSE));
1515 case BACT_SPIN_WHEEL: /* Spin the Wheel Game */
1519 c_put_str(TERM_GREEN, "¥ë¡¼¥ì¥Ã¥È", 5, 2);
1521 c_put_str(TERM_GREEN, "Wheel", 5, 2);
1524 prt("0 1 2 3 4 5 6 7 8 9", 7, 5);
1525 prt("--------------------------------", 8, 3);
1526 strcpy(out_val, "");
1528 get_string("²¿ÈÖ¡© (0-9): ", out_val, 32);
1530 get_string("Pick a number (0-9): ", out_val, 32);
1533 for (p = out_val; iswspace(*p); p++);
1538 msg_print("0È֤ˤ·¤È¤¯¤¼¡£");
1540 msg_print("I'll put you down for 0.");
1545 else if (choice > 9)
1548 msg_print("£Ï£Ë¡¢9È֤ˤ·¤È¤¯¤¼¡£");
1550 msg_print("Ok, I'll put you down for 9.");
1556 roll1 = randint0(10);
1558 sprintf(tmp_str, "¥ë¡¼¥ì¥Ã¥È¤Ï²ó¤ê¡¢»ß¤Þ¤Ã¤¿¡£¾¡¼Ô¤Ï %dÈÖ¤À¡£",
1560 sprintf(tmp_str, "The wheel spins to a stop and the winner is %d",
1564 prt(tmp_str, 13, 3);
1566 prt("*", 9, (3 * roll1 + 5));
1567 if (roll1 == choice)
1571 case BACT_DICE_SLOTS: /* The Dice Slots */
1573 c_put_str(TERM_GREEN, "¥À¥¤¥¹¡¦¥¹¥í¥Ã¥È", 5, 2);
1574 c_put_str(TERM_YELLOW, "¥ì¥â¥ó ¥ì¥â¥ó 2", 6, 37);
1575 c_put_str(TERM_YELLOW, "¥ì¥â¥ó ¥ì¥â¥ó ¥ì¥â¥ó 5", 7, 37);
1576 c_put_str(TERM_ORANGE, "¥ª¥ì¥ó¥¸ ¥ª¥ì¥ó¥¸ ¥ª¥ì¥ó¥¸ 10", 8, 37);
1577 c_put_str(TERM_UMBER, "·õ ·õ ·õ 20", 9, 37);
1578 c_put_str(TERM_SLATE, "½â ½â ½â 50", 10, 37);
1579 c_put_str(TERM_VIOLET, "¥×¥é¥à ¥×¥é¥à ¥×¥é¥à 200", 11, 37);
1580 c_put_str(TERM_RED, "¥Á¥§¥ê¡¼ ¥Á¥§¥ê¡¼ ¥Á¥§¥ê¡¼ 1000", 12, 37);
1582 c_put_str(TERM_GREEN, "Dice Slots", 5, 2);
1586 roll1 = randint1(21);
1596 roll2 = randint1(21);
1606 choice = randint1(21);
1616 put_str("/--------------------------\\", 7, 2);
1617 prt("\\--------------------------/", 17, 2);
1618 display_fruit(8, 3, roll1 - 1);
1619 display_fruit(8, 12, roll2 - 1);
1620 display_fruit(8, 21, choice - 1);
1621 if ((roll1 == roll2) && (roll2 == choice))
1640 else if ((roll1 == 1) && (roll2 == 1))
1649 if (odds) win = TRUE;
1656 prt("¤¢¤Ê¤¿¤Î¾¡¤Á", 16, 37);
1658 prt("YOU WON", 16, 37);
1661 p_ptr->au += odds * wager;
1663 sprintf(tmp_str, "ÇÜΨ: %d", odds);
1665 sprintf(tmp_str, "Payoff: %d", odds);
1668 prt(tmp_str, 17, 37);
1673 prt("¤¢¤Ê¤¿¤ÎÉ餱", 16, 37);
1675 prt("You Lost", 16, 37);
1681 sprintf(tmp_str, "¸½ºß¤Î½ê»ý¶â: %9ld", (long int)p_ptr->au);
1683 sprintf(tmp_str, "Current Gold: %9ld", (long int)p_ptr->au);
1686 prt(tmp_str, 22, 2);
1688 prt("¤â¤¦°ìÅÙ(Y/N)¡©", 18, 37);
1690 prt("Again(Y/N)?", 18, 37);
1693 move_cursor(18, 52);
1698 if (wager > p_ptr->au)
1701 msg_print("¤ª¤¤¡ª¶â¤¬Â¤ê¤Ê¤¤¤¸¤ã¤Ê¤¤¤«¡ª¤³¤³¤«¤é½Ð¤Æ¹Ô¤±¡ª");
1703 msg_print("Hey! You don't have the gold - get out of here!");
1711 } while ((again == 'y') || (again == 'Y'));
1714 if (p_ptr->au >= oldgold)
1717 msg_print("¡Öº£²ó¤ÏÌÙ¤±¤¿¤Ê¡ª¤Ç¤â¼¡¤Ï¤³¤Ã¤Á¤¬¾¡¤Ã¤Æ¤ä¤ë¤«¤é¤Ê¡¢ÀäÂФˡª¡×");
1719 msg_print("You came out a winner! We'll win next time, I'm sure.");
1721 chg_virtue(V_CHANCE, 3);
1726 msg_print("¡Ö¶â¤ò¥¹¥Ã¤Æ¤·¤Þ¤Ã¤¿¤Ê¡¢¤ï¤Ï¤Ï¡ª¤¦¤Á¤Ëµ¢¤Ã¤¿Êý¤¬¤¤¤¤¤¼¡£¡×");
1728 msg_print("You lost gold! Haha, better head home.");
1730 chg_virtue(V_CHANCE, -3);
1740 * @brief ¥â¥ó¥¹¥¿¡¼Æ®µ»¾ì¤Ë»²²Ã¤Ç¤¤ë¥â¥ó¥¹¥¿¡¼¤ÎȽÄê
1741 * @param r_idx ¥â¥ó¥¹¥¿¡¼£É£Ä
1742 * @details ´ð½à¤ÏNEVER_MOVE MULTIPLY QUANTUM RF7_AQUATIC RF7_CHAMELEON¤Î¤¤¤º¤ì¤â»ý¤¿¤º¡¢
1743 * ¼«Çú°Ê³°¤Î¤Ê¤ó¤é¤«¤ÎHP¹¶·â¼êÃʤò»ý¤Ã¤Æ¤¤¤ë¤³¤È¡£
1744 * @return »²²Ã¤Ç¤¤ë¤«Èݤ«
1746 static bool vault_aux_battle(int r_idx)
1751 monster_race *r_ptr = &r_info[r_idx];
1753 /* Decline town monsters */
1754 /* if (!mon_hook_dungeon(r_idx)) return FALSE; */
1756 /* Decline unique monsters */
1757 /* if (r_ptr->flags1 & (RF1_UNIQUE)) return (FALSE); */
1758 /* if (r_ptr->flags7 & (RF7_NAZGUL)) return (FALSE); */
1760 if (r_ptr->flags1 & (RF1_NEVER_MOVE)) return (FALSE);
1761 if (r_ptr->flags2 & (RF2_MULTIPLY)) return (FALSE);
1762 if (r_ptr->flags2 & (RF2_QUANTUM)) return (FALSE);
1763 if (r_ptr->flags7 & (RF7_AQUATIC)) return (FALSE);
1764 if (r_ptr->flags7 & (RF7_CHAMELEON)) return (FALSE);
1766 for (i = 0; i < 4; i++)
1768 if (r_ptr->blow[i].method == RBM_EXPLODE) return (FALSE);
1769 if (r_ptr->blow[i].effect != RBE_DR_MANA) dam += r_ptr->blow[i].d_dice;
1771 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);
1778 * @brief ¥â¥ó¥¹¥¿¡¼Æ®µ»¾ì¤Ë»²²Ã¤¹¤ë¥â¥ó¥¹¥¿¡¼¤ò¥ê¥»¥Ã¥È¤¹¤ë¡£
1781 void battle_monsters(void)
1788 bool old_inside_battle = p_ptr->inside_battle;
1790 for (i = 0; i < max_d_idx; i++)
1791 if (max_dl < max_dlv[i]) max_dl = max_dlv[i];
1793 mon_level = randint1(MIN(max_dl, 122))+5;
1794 if (randint0(100) < 60)
1796 i = randint1(MIN(max_dl, 122))+5;
1797 mon_level = MAX(i, mon_level);
1799 if (randint0(100) < 30)
1801 i = randint1(MIN(max_dl, 122))+5;
1802 mon_level = MAX(i, mon_level);
1814 get_mon_num_prep(vault_aux_battle, NULL);
1815 p_ptr->inside_battle = TRUE;
1816 r_idx = get_mon_num(mon_level);
1817 p_ptr->inside_battle = old_inside_battle;
1818 if (!r_idx) continue;
1820 if ((r_info[r_idx].flags1 & RF1_UNIQUE) || (r_info[r_idx].flags7 & RF7_UNIQUE2))
1822 if ((r_info[r_idx].level + 10) > mon_level) continue;
1825 for (j = 0; j < i; j++)
1826 if(r_idx == battle_mon[j]) break;
1831 battle_mon[i] = r_idx;
1832 if (r_info[r_idx].level < 45) tekitou = TRUE;
1837 monster_race *r_ptr = &r_info[battle_mon[i]];
1838 int num_taisei = count_bits(r_ptr->flagsr & (RFR_IM_ACID | RFR_IM_ELEC | RFR_IM_FIRE | RFR_IM_COLD | RFR_IM_POIS));
1840 if (r_ptr->flags1 & RF1_FORCE_MAXHP)
1841 power[i] = r_ptr->hdice * r_ptr->hside * 2;
1843 power[i] = r_ptr->hdice * (r_ptr->hside + 1);
1844 power[i] = power[i] * (100 + r_ptr->level) / 100;
1845 if (r_ptr->speed > 110)
1846 power[i] = power[i] * (r_ptr->speed * 2 - 110) / 100;
1847 if (r_ptr->speed < 110)
1848 power[i] = power[i] * (r_ptr->speed - 20) / 100;
1850 power[i] = power[i] * (num_taisei*2+5) / 10;
1851 else if (r_ptr->flags6 & RF6_INVULNER)
1852 power[i] = power[i] * 4 / 3;
1853 else if (r_ptr->flags6 & RF6_HEAL)
1854 power[i] = power[i] * 4 / 3;
1855 else if (r_ptr->flags5 & RF5_DRAIN_MANA)
1856 power[i] = power[i] * 11 / 10;
1857 if (r_ptr->flags1 & RF1_RAND_25)
1858 power[i] = power[i] * 9 / 10;
1859 if (r_ptr->flags1 & RF1_RAND_50)
1860 power[i] = power[i] * 9 / 10;
1862 switch (battle_mon[i])
1873 case MON_UND_BEHOLDER:
1874 case MON_SANTACLAUS:
1875 case MON_ULT_BEHOLDER:
1877 case MON_ATLACH_NACHA:
1879 power[i] = power[i] * 3 / 5;
1881 case MON_ROBIN_HOOD:
1885 case MON_CRYPT_THING:
1886 case MON_MASTER_LICH:
1887 case MON_DREADMASTER:
1889 case MON_SHADOWLORD:
1894 case MON_VENOM_WYRM:
1895 case MON_MASTER_MYS:
1896 case MON_G_MASTER_MYS:
1897 power[i] = power[i] * 3 / 4;
1899 case MON_VORPAL_BUNNY:
1902 case MON_LOG_MASTER:
1904 case MON_GRAV_HOUND:
1907 case MON_CLUB_DEMON:
1909 case MON_NIGHTCRAWLER:
1910 case MON_NIGHTWALKER:
1916 case MON_SPECT_WYRM:
1921 power[i] = power[i] * 4 / 3;
1923 case MON_UMBER_HULK:
1927 case MON_ENERGY_VOR:
1931 case MON_PLASMA_VOR:
1936 case MON_STORMBRINGER:
1937 case MON_TIME_HOUND:
1938 case MON_PLASMA_HOUND:
1941 case MON_AETHER_VOR:
1942 case MON_AETHER_HOUND:
1950 case MON_D_ELF_SHADE:
1951 case MON_MANA_HOUND:
1953 case MON_BANORLUPART:
1958 power[i] = power[i] * 3 / 2;
1962 case MON_CYBER_KING:
1963 case MON_UNICORN_ORD:
1964 power[i] = power[i] * 5 / 3;
1968 case MON_WYRM_POWER:
1988 power[i] = total*60/power[i];
1989 if (tekitou && ((power[i] < 160) || power[i] > 1500)) break;
1990 if ((power[i] < 160) && randint0(20)) break;
1991 if (power[i] < 101) power[i] = 100 + randint1(5);
1992 mon_odds[i] = power[i];
1999 * @brief ¥â¥ó¥¹¥¿¡¼Æ®µ»¾ì¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó
2000 * @return ÅÒ¤±¤ò³«»Ï¤·¤¿¤«Èݤ«
2002 static bool kakutoujou(void)
2006 char out_val[160], tmp_str[80];
2009 if ((turn - old_battle) > TURNS_PER_TICK*250)
2021 msg_print("¤ª¤¤¡ª¤ª¤Þ¤¨°ìʸ¤Ê¤·¤¸¤ã¤Ê¤¤¤«¡ª¤³¤Ã¤«¤é½Ð¤Æ¤¤¤±¡ª");
2023 msg_print("Hey! You don't have gold - get out of here!");
2037 prt("¥â¥ó¥¹¥¿¡¼ ÇÜΨ", 4, 4);
2039 prt("Monsters Odds", 4, 4);
2044 monster_race *r_ptr = &r_info[battle_mon[i]];
2047 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);
2049 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);
2055 prt("¤É¤ì¤ËÅÒ¤±¤Þ¤¹¤«:", 0, 0);
2057 prt("Which monster: ", 0, 0);
2068 if (i >= '1' && i <= '4')
2070 sel_monster = i-'1';
2071 battle_odds = mon_odds[sel_monster];
2079 if (i !=sel_monster) clear_bldg(i+5,i+5);
2081 maxbet = p_ptr->lev * 200;
2083 /* We can't bet more than we have */
2084 maxbet = MIN(maxbet, p_ptr->au);
2087 strcpy(out_val, "");
2089 sprintf(tmp_str,"ÅÒ¤±¶â (1-%ld)¡©", (long int)maxbet);
2091 sprintf(tmp_str,"Your wager (1-%ld) ? ", (long int)maxbet);
2096 * Use get_string() because we may need more than
2097 * the s16b value returned by get_quantity().
2099 if (get_string(tmp_str, out_val, 32))
2102 for (p = out_val; *p == ' '; p++);
2107 if (wager > p_ptr->au)
2110 msg_print("¤ª¤¤¡ª¶â¤¬Â¤ê¤Ê¤¤¤¸¤ã¤Ê¤¤¤«¡ª½Ð¤Æ¤¤¤±¡ª");
2112 msg_print("Hey! You don't have the gold - get out of here!");
2119 else if (wager > maxbet)
2122 msg_format("%ld¥´¡¼¥ë¥É¤À¤±¼õ¤±¤è¤¦¡£»Ä¤ê¤Ï¼è¤Ã¤È¤¤Ê¡£", (long int)maxbet);
2124 msg_format("I'll take %ld gold of that. Keep the rest.",(long int) maxbet);
2132 msg_print("£Ï£Ë¡¢£±¥´¡¼¥ë¥É¤Ç¤¤¤³¤¦¡£");
2134 msg_print("Ok, we'll start with 1 gold.");
2141 battle_odds = MAX(wager+1, wager * battle_odds / 100);
2146 /* Save the surface floor as saved floor */
2147 prepare_change_floor_mode(CFM_SAVE_FLOORS);
2149 p_ptr->inside_battle = TRUE;
2150 p_ptr->leaving = TRUE;
2164 * @brief ËÜÆü¤Î¾Þ¶â¼ó¾ðÊó¤òɽ¼¨¤¹¤ë¡£
2167 static void today_target(void)
2170 monster_race *r_ptr = &r_info[today_mon];
2174 c_put_str(TERM_YELLOW, "ËÜÆü¤Î¾Þ¶â¼ó", 5, 10);
2176 prt("Wanted monster that changes from day to day", 5, 10);
2179 sprintf(buf,"¥¿¡¼¥²¥Ã¥È¡§ %s",r_name + r_ptr->name);
2181 sprintf(buf,"target: %s",r_name + r_ptr->name);
2183 c_put_str(TERM_YELLOW, buf, 6, 10);
2185 sprintf(buf,"»àÂÎ ---- $%d",r_ptr->level * 50 + 100);
2187 sprintf(buf,"corpse ---- $%d",r_ptr->level * 50 + 100);
2191 sprintf(buf,"¹ü ---- $%d",r_ptr->level * 30 + 60);
2193 sprintf(buf,"skeleton ---- $%d",r_ptr->level * 30 + 60);
2196 p_ptr->today_mon = today_mon;
2200 * @brief ¥Ä¥Á¥Î¥³¤Î¾Þ¶â¼ó¾ðÊó¤òɽ¼¨¤¹¤ë¡£
2203 static void tsuchinoko(void)
2207 c_put_str(TERM_YELLOW, "°ì³ÍÀé¶â¤ÎÂç¥Á¥ã¥ó¥¹¡ª¡ª¡ª", 5, 10);
2208 c_put_str(TERM_YELLOW, "¥¿¡¼¥²¥Ã¥È¡§¸¸¤ÎÄÁ½Ã¡Ö¥Ä¥Á¥Î¥³¡×", 6, 10);
2209 c_put_str(TERM_WHITE, "À¸¤±Êá¤ê ---- $1,000,000", 8, 10);
2210 c_put_str(TERM_WHITE, "»àÂÎ ---- $200,000", 9, 10);
2211 c_put_str(TERM_WHITE, "¹ü ---- $100,000", 10, 10);
2213 c_put_str(TERM_YELLOW, "Big chance to quick money!!!", 5, 10);
2214 c_put_str(TERM_YELLOW, "target: the rarest animal 'Tsuchinoko'", 6, 10);
2215 c_put_str(TERM_WHITE, "catch alive ---- $1,000,000", 8, 10);
2216 c_put_str(TERM_WHITE, "corpse ---- $200,000", 9, 10);
2217 c_put_str(TERM_WHITE, "bones ---- $100,000", 10, 10);
2222 * @brief Ä̾ï¤Î¾Þ¶â¼ó¾ðÊó¤òɽ¼¨¤¹¤ë¡£
2225 static void shoukinkubi(void)
2233 prt("»àÂΤò»ý¤Áµ¢¤ì¤ÐÊó½·¤òº¹¤·¾å¤²¤Þ¤¹¡£",4 ,10);
2234 c_put_str(TERM_YELLOW, "¸½ºß¤Î¾Þ¶â¼ó", 6, 10);
2236 prt("Offer a prize when you bring a wanted monster's corpse",4 ,10);
2237 c_put_str(TERM_YELLOW, "Wanted monsters", 6, 10);
2240 for (i = 0; i < MAX_KUBI; i++)
2244 monster_race *r_ptr = &r_info[(kubi_r_idx[i] > 10000 ? kubi_r_idx[i] - 10000 : kubi_r_idx[i])];
2246 if (kubi_r_idx[i] > 10000)
2252 done_mark = "(done)";
2261 c_prt(color, format("%s %s", r_name + r_ptr->name, done_mark), y+7, 10);
2264 if (!y && (i < MAX_KUBI -1))
2267 prt("²¿¤«¥¡¼¤ò²¡¤·¤Æ¤¯¤À¤µ¤¤", 0, 0);
2269 prt("Hit any key.", 0, 0);
2281 * ¾Þ¶â¼ó¤ÎÊ󽷥ơ¼¥Ö¥ë / List of prize object
2286 } prize_list[MAX_KUBI] =
2288 {TV_POTION, SV_POTION_CURING},
2289 {TV_POTION, SV_POTION_SPEED},
2290 {TV_POTION, SV_POTION_SPEED},
2291 {TV_POTION, SV_POTION_RESISTANCE},
2292 {TV_POTION, SV_POTION_ENLIGHTENMENT},
2294 {TV_POTION, SV_POTION_HEALING},
2295 {TV_POTION, SV_POTION_RESTORE_MANA},
2296 {TV_SCROLL, SV_SCROLL_STAR_DESTRUCTION},
2297 {TV_POTION, SV_POTION_STAR_ENLIGHTENMENT},
2298 {TV_SCROLL, SV_SCROLL_SUMMON_PET},
2300 {TV_SCROLL, SV_SCROLL_GENOCIDE},
2301 {TV_POTION, SV_POTION_STAR_HEALING},
2302 {TV_POTION, SV_POTION_STAR_HEALING},
2303 {TV_POTION, SV_POTION_NEW_LIFE},
2304 {TV_SCROLL, SV_SCROLL_MASS_GENOCIDE},
2306 {TV_POTION, SV_POTION_LIFE},
2307 {TV_POTION, SV_POTION_LIFE},
2308 {TV_POTION, SV_POTION_AUGMENTATION},
2309 {TV_POTION, SV_POTION_INVULNERABILITY},
2310 {TV_SCROLL, SV_SCROLL_ARTIFACT},
2314 * @brief ¾Þ¶â¼ó¤Î°ú¤´¹¤¨½èÍý / Get prize
2315 * @return ³Æ¼ï¾Þ¶â¼ó¤Î¤¤¤º¤ì¤«¤Ç¤â´¹¶â¤¬¹Ô¤ï¤ì¤¿¤«Èݤ«¡£
2317 static bool kankin(void)
2320 bool change = FALSE;
2321 char o_name[MAX_NLEN];
2324 /* Loop for inventory and right/left arm */
2325 for (i = 0; i <= INVEN_LARM; i++)
2327 o_ptr = &inventory[i];
2329 /* Living Tsuchinoko worthes $1000000 */
2330 if ((o_ptr->tval == TV_CAPTURE) && (o_ptr->pval == MON_TSUCHINOKO))
2332 char buf[MAX_NLEN+20];
2333 object_desc(o_name, o_ptr, 0);
2335 sprintf(buf, "%s ¤ò´¹¶â¤·¤Þ¤¹¤«¡©",o_name);
2337 sprintf(buf, "Convert %s into money? ",o_name);
2342 msg_format("¾Þ¶â %ld¡ð¤ò¼ê¤ËÆþ¤ì¤¿¡£", (long int)(1000000L * o_ptr->number));
2344 msg_format("You get %ldgp.", (long int)(1000000L * o_ptr->number));
2346 p_ptr->au += 1000000L * o_ptr->number;
2347 p_ptr->redraw |= (PR_GOLD);
2348 inven_item_increase(i, -o_ptr->number);
2349 inven_item_describe(i);
2350 inven_item_optimize(i);
2356 for (i = 0; i < INVEN_PACK; i++)
2358 o_ptr = &inventory[i];
2360 /* Corpse of Tsuchinoko worthes $200000 */
2361 if ((o_ptr->tval == TV_CORPSE) && (o_ptr->sval == SV_CORPSE) && (o_ptr->pval == MON_TSUCHINOKO))
2363 char buf[MAX_NLEN+20];
2364 object_desc(o_name, o_ptr, 0);
2366 sprintf(buf, "%s ¤ò´¹¶â¤·¤Þ¤¹¤«¡©",o_name);
2368 sprintf(buf, "Convert %s into money? ",o_name);
2373 msg_format("¾Þ¶â %ld¡ð¤ò¼ê¤ËÆþ¤ì¤¿¡£", (long int)(200000L * o_ptr->number));
2375 msg_format("You get %ldgp.", (long int)(200000L * o_ptr->number));
2377 p_ptr->au += 200000L * o_ptr->number;
2378 p_ptr->redraw |= (PR_GOLD);
2379 inven_item_increase(i, -o_ptr->number);
2380 inven_item_describe(i);
2381 inven_item_optimize(i);
2387 for (i = 0; i < INVEN_PACK; i++)
2389 o_ptr = &inventory[i];
2391 /* Bones of Tsuchinoko worthes $100000 */
2392 if ((o_ptr->tval == TV_CORPSE) && (o_ptr->sval == SV_SKELETON) && (o_ptr->pval == MON_TSUCHINOKO))
2394 char buf[MAX_NLEN+20];
2395 object_desc(o_name, o_ptr, 0);
2397 sprintf(buf, "%s ¤ò´¹¶â¤·¤Þ¤¹¤«¡©",o_name);
2399 sprintf(buf, "Convert %s into money? ",o_name);
2404 msg_format("¾Þ¶â %ld¡ð¤ò¼ê¤ËÆþ¤ì¤¿¡£", (long int)(100000L * o_ptr->number));
2406 msg_format("You get %ldgp.", (long int)(100000L * o_ptr->number));
2408 p_ptr->au += 100000L * o_ptr->number;
2409 p_ptr->redraw |= (PR_GOLD);
2410 inven_item_increase(i, -o_ptr->number);
2411 inven_item_describe(i);
2412 inven_item_optimize(i);
2418 for (i = 0; i < INVEN_PACK; i++)
2420 o_ptr = &inventory[i];
2421 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)))
2423 char buf[MAX_NLEN+20];
2424 object_desc(o_name, o_ptr, 0);
2426 sprintf(buf, "%s ¤ò´¹¶â¤·¤Þ¤¹¤«¡©",o_name);
2428 sprintf(buf, "Convert %s into money? ",o_name);
2433 msg_format("¾Þ¶â %ld¡ð¤ò¼ê¤ËÆþ¤ì¤¿¡£", (long int)((r_info[today_mon].level * 50 + 100) * o_ptr->number));
2435 msg_format("You get %ldgp.", (long int)((r_info[today_mon].level * 50 + 100) * o_ptr->number));
2437 p_ptr->au += (r_info[today_mon].level * 50 + 100) * o_ptr->number;
2438 p_ptr->redraw |= (PR_GOLD);
2439 inven_item_increase(i, -o_ptr->number);
2440 inven_item_describe(i);
2441 inven_item_optimize(i);
2447 for (i = 0; i < INVEN_PACK; i++)
2449 o_ptr = &inventory[i];
2451 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)))
2453 char buf[MAX_NLEN+20];
2454 object_desc(o_name, o_ptr, 0);
2456 sprintf(buf, "%s ¤ò´¹¶â¤·¤Þ¤¹¤«¡©",o_name);
2458 sprintf(buf, "Convert %s into money? ",o_name);
2463 msg_format("¾Þ¶â %ld¡ð¤ò¼ê¤ËÆþ¤ì¤¿¡£", (long int)((r_info[today_mon].level * 30 + 60) * o_ptr->number));
2465 msg_format("You get %ldgp.", (long int)((r_info[today_mon].level * 30 + 60) * o_ptr->number));
2467 p_ptr->au += (r_info[today_mon].level * 30 + 60) * o_ptr->number;
2468 p_ptr->redraw |= (PR_GOLD);
2469 inven_item_increase(i, -o_ptr->number);
2470 inven_item_describe(i);
2471 inven_item_optimize(i);
2477 for (j = 0; j < MAX_KUBI; j++)
2479 /* Need reverse order --- Positions will be changed in the loop */
2480 for (i = INVEN_PACK-1; i >= 0; i--)
2482 o_ptr = &inventory[i];
2483 if ((o_ptr->tval == TV_CORPSE) && (o_ptr->pval == kubi_r_idx[j]))
2485 char buf[MAX_NLEN+20];
2486 int num, k, item_new;
2489 object_desc(o_name, o_ptr, 0);
2491 sprintf(buf, "%s¤òÅϤ·¤Þ¤¹¤«¡©",o_name);
2493 sprintf(buf, "Hand %s over? ",o_name);
2495 if (!get_check(buf)) continue;
2497 #if 0 /* Obsoleted */
2499 msg_format("¾Þ¶â %ld¡ð¤ò¼ê¤ËÆþ¤ì¤¿¡£", (r_info[kubi_r_idx[j]].level + 1) * 300 * o_ptr->number);
2501 msg_format("You get %ldgp.", (r_info[kubi_r_idx[j]].level + 1) * 300 * o_ptr->number);
2503 p_ptr->au += (r_info[kubi_r_idx[j]].level+1) * 300 * o_ptr->number;
2504 p_ptr->redraw |= (PR_GOLD);
2505 inven_item_increase(i, -o_ptr->number);
2506 inven_item_describe(i);
2507 inven_item_optimize(i);
2508 chg_virtue(V_JUSTICE, 5);
2509 kubi_r_idx[j] += 10000;
2512 #endif /* Obsoleted */
2515 inven_item_increase(i, -o_ptr->number);
2516 inven_item_describe(i);
2517 inven_item_optimize(i);
2519 chg_virtue(V_JUSTICE, 5);
2520 kubi_r_idx[j] += 10000;
2522 /* Count number of unique corpses already handed */
2523 for (num = 0, k = 0; k < MAX_KUBI; k++)
2525 if (kubi_r_idx[k] >= 10000) num++;
2529 msg_format("¤³¤ì¤Ç¹ç·× %d ¥Ý¥¤¥ó¥È³ÍÆÀ¤·¤Þ¤·¤¿¡£", num);
2531 msg_format("You earned %d point%s total.", num, (num > 1 ? "s" : ""));
2534 /* Prepare to make a prize */
2535 object_prep(&forge, lookup_kind(prize_list[num-1].tval, prize_list[num-1].sval));
2536 apply_magic(&forge, object_level, AM_NO_FIXED_ART);
2538 /* Identify it fully */
2539 object_aware(&forge);
2540 object_known(&forge);
2543 * Hand it --- Assume there is an empty slot.
2544 * Since a corpse is handed at first,
2545 * there is at least one empty slot.
2547 item_new = inven_carry(&forge);
2549 /* Describe the object */
2550 object_desc(o_name, &forge, 0);
2552 msg_format("%s(%c)¤òÌã¤Ã¤¿¡£", o_name, index_to_label(item_new));
2554 msg_format("You get %s (%c). ", o_name, index_to_label(item_new));
2557 /* Auto-inscription */
2558 autopick_alter_item(item_new, FALSE);
2571 msg_print("¾Þ¶â¤òÆÀ¤é¤ì¤½¤¦¤Ê¤â¤Î¤Ï»ý¤Ã¤Æ¤¤¤Ê¤«¤Ã¤¿¡£");
2573 msg_print("You have nothing.");
2582 * @brief °Ì´¤Î¸µ¶§¤È¤Ê¤ë¥â¥ó¥¹¥¿¡¼¤«¤É¤¦¤«¤òÊÖ¤¹¡£
2583 * @param r_idx ȽÄêÂоݤȤʤë¥â¥ó¥¹¥¿¡¼¤Î£É£Ä
2584 * @return °Ì´¤Î¸µ¶§¤È¤Ê¤êÆÀ¤ë¤«Èݤ«¡£
2586 bool get_nightmare(int r_idx)
2588 monster_race *r_ptr = &r_info[r_idx];
2590 /* Require eldritch horrors */
2591 if (!(r_ptr->flags2 & (RF2_ELDRITCH_HORROR))) return (FALSE);
2593 /* Require high level */
2594 if (r_ptr->level <= p_ptr->lev) return (FALSE);
2596 /* Accept this monster */
2601 * @brief °Ì´¥â¡¼¥É»þ¤Ë¿ç̲/Ëãáã¤Ë´Ù¤Ã¤¿ºÝ¤ÎEldritchHorror½èÍý
2602 * @param r_idx ¶¸µ¤¤Î¸µ¶§¤È¤Ê¤ë¥â¥ó¥¹¥¿¡¼¤Î£É£Ä
2604 * @todo ½ÅÊ£´Ø¿ô¤¢¤ê¡¢Í×¥ê¥Õ¥¡¥¯¥¿¥ê¥ó¥°¡£
2606 void have_nightmare(int r_idx)
2608 bool happened = FALSE;
2609 monster_race *r_ptr = &r_info[r_idx];
2610 int power = r_ptr->level + 10;
2612 cptr desc = r_name + r_ptr->name;
2616 if (!(r_ptr->flags1 & RF1_UNIQUE))
2617 sprintf(m_name, "%s %s", (is_a_vowel(desc[0]) ? "an" : "a"), desc);
2620 sprintf(m_name, "%s", desc);
2622 if (!(r_ptr->flags1 & RF1_UNIQUE))
2624 if (r_ptr->flags1 & RF1_FRIENDS) power /= 2;
2628 if (saving_throw(p_ptr->skill_sav * 100 / power))
2631 msg_format("Ì´¤ÎÃæ¤Ç%s¤ËÄɤ¤¤«¤±¤é¤ì¤¿¡£", m_name);
2633 msg_format("%^s chases you through your dreams.", m_name);
2642 /* Something silly happens... */
2644 msg_format("%s%s¤Î´é¤ò¸«¤Æ¤·¤Þ¤Ã¤¿¡ª",
2646 msg_format("You behold the %s visage of %s!",
2649 funny_desc[randint0(MAX_SAN_FUNNY)], m_name);
2653 msg_print(funny_comments[randint0(MAX_SAN_COMMENT)]);
2654 p_ptr->image = p_ptr->image + randint1(r_ptr->level);
2657 /* Never mind; we can't see it clearly enough */
2661 /* Something frightening happens... */
2663 msg_format("%s%s¤Î´é¤ò¸«¤Æ¤·¤Þ¤Ã¤¿¡ª",
2665 msg_format("You behold the %s visage of %s!",
2668 horror_desc[randint0(MAX_SAN_HORROR)], desc);
2670 r_ptr->r_flags2 |= RF2_ELDRITCH_HORROR;
2672 if (!p_ptr->mimic_form)
2674 switch (p_ptr->prace)
2676 /* Demons may make a saving throw */
2679 if (saving_throw(20 + p_ptr->lev)) return;
2681 /* Undead may make a saving throw */
2686 if (saving_throw(10 + p_ptr->lev)) return;
2692 /* Demons may make a saving throw */
2693 if (mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_DEMON)
2695 if (saving_throw(20 + p_ptr->lev)) return;
2697 /* Undead may make a saving throw */
2698 else if (mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_UNDEAD)
2700 if (saving_throw(10 + p_ptr->lev)) return;
2705 if (!saving_throw(p_ptr->skill_sav * 100 / power))
2707 if (!p_ptr->resist_conf)
2709 (void)set_confused(p_ptr->confused + randint0(4) + 4);
2711 if (!p_ptr->resist_chaos && one_in_(3))
2713 (void)set_image(p_ptr->image + randint0(250) + 150);
2718 /* Lose int & wis */
2719 if (!saving_throw(p_ptr->skill_sav * 100 / power))
2727 if (!saving_throw(p_ptr->skill_sav * 100 / power))
2729 if (!p_ptr->resist_conf)
2731 (void)set_confused(p_ptr->confused + randint0(4) + 4);
2733 if (!p_ptr->free_act)
2735 (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
2737 while (!saving_throw(p_ptr->skill_sav))
2739 (void)do_dec_stat(A_INT);
2741 while (!saving_throw(p_ptr->skill_sav))
2743 (void)do_dec_stat(A_WIS);
2745 if (!p_ptr->resist_chaos)
2747 (void)set_image(p_ptr->image + randint0(250) + 150);
2754 if (!saving_throw(p_ptr->skill_sav * 100 / power))
2756 if (lose_all_info())
2759 msg_print("¤¢¤Þ¤ê¤Î¶²ÉݤËÁ´¤Æ¤Î¤³¤È¤ò˺¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª");
2761 msg_print("You forget everything in your utmost terror!");
2768 /* Else gain permanent insanity */
2769 if ((p_ptr->muta3 & MUT3_MORONIC) && (p_ptr->muta2 & MUT2_BERS_RAGE) &&
2770 ((p_ptr->muta2 & MUT2_COWARDICE) || (p_ptr->resist_fear)) &&
2771 ((p_ptr->muta2 & MUT2_HALLU) || (p_ptr->resist_chaos)))
2773 /* The poor bastard already has all possible insanities! */
2779 switch (randint1(4))
2783 if (!(p_ptr->muta3 & MUT3_MORONIC))
2785 if ((p_ptr->stat_use[A_INT] < 4) && (p_ptr->stat_use[A_WIS] < 4))
2788 msg_print("¤¢¤Ê¤¿¤Ï´°àú¤ÊÇϼ¯¤Ë¤Ê¤Ã¤¿¤è¤¦¤Êµ¤¤¬¤·¤¿¡£¤·¤«¤·¤½¤ì¤Ï¸µ¡¹¤À¤Ã¤¿¡£");
2790 msg_print("You turn into an utter moron!");
2796 msg_print("¤¢¤Ê¤¿¤Ï´°àú¤ÊÇϼ¯¤Ë¤Ê¤Ã¤¿¡ª");
2798 msg_print("You turn into an utter moron!");
2802 if (p_ptr->muta3 & MUT3_HYPER_INT)
2805 msg_print("¤¢¤Ê¤¿¤ÎǾ¤ÏÀ¸ÂÎ¥³¥ó¥Ô¥å¡¼¥¿¤Ç¤Ï¤Ê¤¯¤Ê¤Ã¤¿¡£");
2807 msg_print("Your brain is no longer a living computer.");
2810 p_ptr->muta3 &= ~(MUT3_HYPER_INT);
2812 p_ptr->muta3 |= MUT3_MORONIC;
2819 if (!(p_ptr->muta2 & MUT2_COWARDICE) && !p_ptr->resist_fear)
2822 msg_print("¤¢¤Ê¤¿¤Ï¥Ñ¥é¥Î¥¤¥¢¤Ë¤Ê¤Ã¤¿¡ª");
2824 msg_print("You become paranoid!");
2828 /* Duh, the following should never happen, but anyway... */
2829 if (p_ptr->muta3 & MUT3_FEARLESS)
2832 msg_print("¤¢¤Ê¤¿¤Ï¤â¤¦¶²¤ìÃΤ餺¤Ç¤Ï¤Ê¤¯¤Ê¤Ã¤¿¡£");
2834 msg_print("You are no longer fearless.");
2837 p_ptr->muta3 &= ~(MUT3_FEARLESS);
2840 p_ptr->muta2 |= MUT2_COWARDICE;
2847 if (!(p_ptr->muta2 & MUT2_HALLU) && !p_ptr->resist_chaos)
2850 msg_print("¸¸³Ð¤ò¤Ò¤µ¯¤³¤¹Àº¿ÀºøÍð¤Ë´Ù¤Ã¤¿¡ª");
2852 msg_print("You are afflicted by a hallucinatory insanity!");
2855 p_ptr->muta2 |= MUT2_HALLU;
2862 if (!(p_ptr->muta2 & MUT2_BERS_RAGE))
2865 msg_print("·ãÎõ¤Ê´¶¾ð¤Îȯºî¤Ë¤ª¤½¤ï¤ì¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¡ª");
2867 msg_print("You become subject to fits of berserk rage!");
2870 p_ptr->muta2 |= MUT2_BERS_RAGE;
2878 p_ptr->update |= PU_BONUS;
2884 * @brief ½É²°¤ÎÍøÍÑ¥µ¥Ö¥ë¡¼¥Á¥ó
2885 * @details inn commands\n
2886 * Note that resting for the night was a perfect way to avoid player\n
2887 * ghosts in the town *if* you could only make it to the inn in time (-:\n
2888 * Now that the ghosts are temporarily disabled in 2.8.X, this function\n
2889 * will not be that useful. I will keep it in the hopes the player\n
2890 * ghost code does become a reality again. Does help to avoid filthy urchins.\n
2891 * Resting at night is also a quick way to restock stores -KMW-\n
2892 * @param cmd ½É²°¤ÎÍøÍÑ»ÜÀßID
2893 * @return »ÜÀߤÎÍøÍѤ¬¼ÂºÝ¤Ë¹Ô¤ï¤ì¤¿¤«Èݤ«¡£
2895 static bool inn_comm(int cmd)
2899 case BACT_FOOD: /* Buy food & drink */
2900 if (p_ptr->food >= PY_FOOD_FULL)
2903 msg_print("º£¤ÏËþÊ¢¤À¡£");
2905 msg_print("You are full now.");
2911 msg_print("¥Ð¡¼¥Æ¥ó¤Ï¤¤¤¯¤é¤«¤Î¿©¤Ùʪ¤È¥Ó¡¼¥ë¤ò¤¯¤ì¤¿¡£");
2913 msg_print("The barkeep gives you some gruel and a beer.");
2916 (void)set_food(PY_FOOD_MAX - 1);
2919 case BACT_REST: /* Rest for the night */
2920 if ((p_ptr->poisoned) || (p_ptr->cut))
2923 msg_print("¤¢¤Ê¤¿¤ËɬÍפʤΤÏÉô²°¤Ç¤Ï¤Ê¤¯¡¢¼£ÎżԤǤ¹¡£");
2925 msg_print("You need a healer, not a room.");
2930 msg_print("¤¹¤ß¤Þ¤»¤ó¡¢¤Ç¤â¤¦¤Á¤Ç狼¤Ë»à¤Ê¤ì¤Á¤ãº¤¤ê¤Þ¤¹¤ó¤Ç¡£");
2932 msg_print("Sorry, but don't want anyone dying in here.");
2937 s32b oldturn = turn;
2938 int prev_day, prev_hour, prev_min;
2940 extract_day_hour_min(&prev_day, &prev_hour, &prev_min);
2942 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "½É²°¤ËÇñ¤Þ¤Ã¤¿¡£");
2944 if ((prev_hour >= 6) && (prev_hour <= 17)) do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "stay over daytime at the inn.");
2945 else do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "stay over night at the inn.");
2947 turn = (turn / (TURNS_PER_TICK*TOWN_DAWN/2) + 1) * (TURNS_PER_TICK*TOWN_DAWN/2);
2948 if (dungeon_turn < dungeon_turn_limit)
2950 dungeon_turn += MIN(turn - oldturn, TURNS_PER_TICK * 250);
2951 if (dungeon_turn > dungeon_turn_limit) dungeon_turn = dungeon_turn_limit;
2954 prevent_turn_overflow();
2956 if ((prev_hour >= 18) && (prev_hour <= 23)) do_cmd_write_nikki(NIKKI_HIGAWARI, 0, NULL);
2957 p_ptr->chp = p_ptr->mhp;
2959 if (ironman_nightmare)
2962 msg_print("̲¤ê¤Ë½¢¤¯¤È¶²¤í¤·¤¤¸÷·Ê¤¬¿´¤ò¤è¤®¤Ã¤¿¡£");
2964 msg_print("Horrible visions flit through your mind as you sleep.");
2967 /* Pick a nightmare */
2968 get_mon_num_prep(get_nightmare, NULL);
2970 /* Have some nightmares */
2973 have_nightmare(get_mon_num(MAX_DEPTH));
2975 if (!one_in_(3)) break;
2978 /* Remove the monster restriction */
2979 get_mon_num_prep(NULL, NULL);
2982 msg_print("¤¢¤Ê¤¿¤ÏÀ䶫¤·¤ÆÌܤò³Ð¤Þ¤·¤¿¡£");
2983 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "°Ì´¤Ë¤¦¤Ê¤µ¤ì¤Æ¤è¤¯Ì²¤ì¤Ê¤«¤Ã¤¿¡£");
2985 msg_print("You awake screaming.");
2986 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "be troubled by a nightmare.");
2994 p_ptr->chp = p_ptr->mhp;
2995 p_ptr->csp = p_ptr->msp;
2996 if (p_ptr->pclass == CLASS_MAGIC_EATER)
2999 for (i = 0; i < 72; i++)
3001 p_ptr->magic_num1[i] = p_ptr->magic_num2[i]*EATER_CHARGE;
3003 for (; i < 108; i++)
3005 p_ptr->magic_num1[i] = 0;
3009 if ((prev_hour >= 6) && (prev_hour <= 17))
3012 msg_print("¤¢¤Ê¤¿¤Ï¥ê¥Õ¥ì¥Ã¥·¥å¤·¤ÆÌܳФᡢͼÊý¤ò·Þ¤¨¤¿¡£");
3013 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "ͼÊý¤ò·Þ¤¨¤¿¡£");
3015 msg_print("You awake refreshed for the evening.");
3016 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "awake refreshed.");
3022 msg_print("¤¢¤Ê¤¿¤Ï¥ê¥Õ¥ì¥Ã¥·¥å¤·¤ÆÌܳФᡢ¿·¤¿¤ÊÆü¤ò·Þ¤¨¤¿¡£");
3023 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "¤¹¤¬¤¹¤¬¤·¤¤Ä«¤ò·Þ¤¨¤¿¡£");
3025 msg_print("You awake refreshed for the new day.");
3026 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "awake refreshed.");
3033 case BACT_RUMORS: /* Listen for rumors */
3035 display_rumor(TRUE);
3045 * @brief ¥¯¥¨¥¹¥È¾ðÊó¤òɽ¼¨¤·¤Ä¤Ä½èÍý¤¹¤ë¡£/ Display quest information
3046 * @param quest ¥¯¥¨¥¹¥È¤ÎID
3047 * @param do_init ¥¯¥¨¥¹¥È¤Î³«»Ï½èÍý(TRUE)¡¢·ë²Ì½èÍý¤«(FALSE)
3050 static void get_questinfo(int questnum, bool do_init)
3057 /* Clear the text */
3058 for (i = 0; i < 10; i++)
3060 quest_text[i][0] = '\0';
3063 quest_text_line = 0;
3065 /* Set the quest number temporary */
3066 old_quest = p_ptr->inside_quest;
3067 p_ptr->inside_quest = questnum;
3069 /* Get the quest text */
3070 init_flags = INIT_SHOW_TEXT;
3071 if (do_init) init_flags |= INIT_ASSIGN;
3073 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
3075 /* Reset the old quest number */
3076 p_ptr->inside_quest = old_quest;
3078 /* Print the quest info */
3080 sprintf(tmp_str, "¥¯¥¨¥¹¥È¾ðÊó (´í¸±ÅÙ: %d ³¬ÁêÅö)", quest[questnum].level);
3082 sprintf(tmp_str, "Quest Information (Danger level: %d)", quest[questnum].level);
3087 prt(quest[questnum].name, 7, 0);
3089 for (i = 0; i < 10; i++)
3091 c_put_str(TERM_YELLOW, quest_text[i], i + 8, 0);
3096 * @brief ¥¯¥¨¥¹¥È½èÍý¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó / Request a quest from the Lord.
3099 static void castle_quest(void)
3102 monster_race *r_ptr;
3109 /* Current quest of the building */
3110 q_index = cave[py][px].special;
3112 /* Is there a quest available at the building? */
3116 put_str("º£¤Î¤È¤³¤í¥¯¥¨¥¹¥È¤Ï¤¢¤ê¤Þ¤»¤ó¡£", 8, 0);
3118 put_str("I don't have a quest for you at the moment.", 8, 0);
3124 q_ptr = &quest[q_index];
3126 /* Quest is completed */
3127 if (q_ptr->status == QUEST_STATUS_COMPLETED)
3129 /* Rewarded quest */
3130 q_ptr->status = QUEST_STATUS_REWARDED;
3132 get_questinfo(q_index, FALSE);
3134 reinit_wilderness = TRUE;
3137 else if (q_ptr->status == QUEST_STATUS_FAILED)
3139 get_questinfo(q_index, FALSE);
3141 /* Mark quest as done (but failed) */
3142 q_ptr->status = QUEST_STATUS_FAILED_DONE;
3144 reinit_wilderness = TRUE;
3146 /* Quest is still unfinished */
3147 else if (q_ptr->status == QUEST_STATUS_TAKEN)
3150 put_str("¤¢¤Ê¤¿¤Ï¸½ºß¤Î¥¯¥¨¥¹¥È¤ò½ªÎ»¤µ¤»¤Æ¤¤¤Þ¤»¤ó¡ª", 8, 0);
3152 put_str("You have not completed your current quest yet!", 8, 0);
3156 put_str("CTRL-Q¤ò»È¤¨¤Ð¥¯¥¨¥¹¥È¤Î¾õÂÖ¤¬¥Á¥§¥Ã¥¯¤Ç¤¤Þ¤¹¡£", 9, 0);
3158 put_str("Use CTRL-Q to check the status of your quest.", 9, 0);
3162 put_str("¥¯¥¨¥¹¥È¤ò½ª¤ï¤é¤»¤¿¤éÌá¤Ã¤ÆÍè¤Æ²¼¤µ¤¤¡£", 12, 0);
3164 put_str("Return when you have completed your quest.", 12, 0);
3169 else if (q_ptr->status == QUEST_STATUS_UNTAKEN)
3171 q_ptr->status = QUEST_STATUS_TAKEN;
3173 reinit_wilderness = TRUE;
3175 /* Assign a new quest */
3176 if (q_ptr->type == QUEST_TYPE_KILL_ANY_LEVEL)
3178 if (q_ptr->r_idx == 0)
3180 /* Random monster at least 5 - 10 levels out of deep */
3181 q_ptr->r_idx = get_mon_num(q_ptr->level + 4 + randint1(6));
3184 r_ptr = &r_info[q_ptr->r_idx];
3186 while ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->rarity != 1))
3188 q_ptr->r_idx = get_mon_num(q_ptr->level) + 4 + randint1(6);
3189 r_ptr = &r_info[q_ptr->r_idx];
3192 if (q_ptr->max_num == 0)
3194 /* Random monster number */
3195 if (randint1(10) > 7)
3198 q_ptr->max_num = randint1(3) + 1;
3202 name = (r_name + r_ptr->name);
3204 msg_format("¥¯¥¨¥¹¥È: %s¤ò %dÂÎÅݤ¹", name,q_ptr->max_num);
3206 msg_format("Your quest: kill %d %s", q_ptr->max_num, name);
3212 get_questinfo(q_index, TRUE);
3219 * @brief Ä®¤Ë´Ø¤¹¤ë¥Ø¥ë¥×¤òɽ¼¨¤¹¤ë / Display town history
3222 static void town_history(void)
3227 /* Peruse the building help file */
3229 (void)show_file(TRUE, "jbldg.txt", NULL, 0, 0);
3231 (void)show_file(TRUE, "bldg.txt", NULL, 0, 0);
3240 * @brief ¼Í·â»þ¥¯¥ê¥Æ¥£¥«¥ë¤Ë¤è¤ë¥À¥á¡¼¥¸´üÂÔÃͽ¤Àµ·×»»¡Ê¥¹¥Ê¥¤¥Ñ¡¼¤Î½¸Ãæ½èÍý¤ÈÉð´ï·Ð¸³ÃÍ¡Ë / critical happens at i / 10000
3241 * @param weight Éð´ï¤Î½ÅÎÌ
3242 * @param plus_ammo ÌðÃƤΥÀ¥á¡¼¥¸½¤Àµ
3243 * @param plus_bow µÝ¤Î¥À¥á¡¼¥¸½¤Àµ
3244 * @param dam ´ðËÜ¥À¥á¡¼¥¸ÎÌ
3245 * @return ¥À¥á¡¼¥¸´üÂÔÃÍ
3247 s16b calc_crit_ratio_shot(int weight, int plus_ammo, int plus_bow, int dam)
3250 object_type *j_ptr = &inventory[INVEN_BOW];
3252 /* Extract "shot" power */
3253 i = p_ptr->to_h_b + plus_ammo;
3255 if (p_ptr->tval_ammo == TV_BOLT)
3256 i = (p_ptr->skill_thb + (p_ptr->weapon_exp[0][j_ptr->sval] / 400 + i) * BTH_PLUS_ADJ);
3258 i = (p_ptr->skill_thb + ((p_ptr->weapon_exp[0][j_ptr->sval] - (WEAPON_EXP_MASTER / 2)) / 200 + i) * BTH_PLUS_ADJ);
3260 /* Snipers can shot more critically with crossbows */
3261 if (p_ptr->concent) i += ((i * p_ptr->concent) / 5);
3262 if ((p_ptr->pclass == CLASS_SNIPER) && (p_ptr->tval_ammo == TV_BOLT)) i *= 2;
3264 /* Good bow makes more critical */
3265 i += plus_bow * 8 * (p_ptr->concent ? p_ptr->concent + 5 : 5);
3273 * @brief ¼Í·â»þ¥¯¥ê¥Æ¥£¥«¥ë¤Ë¤è¤ë¥À¥á¡¼¥¸´üÂÔÃͽ¤Àµ·×»»¡Ê½ÅḬ̂͸Éôʬ¡Ë / critical happens at i / 10000
3274 * @param weight Éð´ï¤Î½ÅÎÌ
3275 * @param plus_ammo ÌðÃƤΥÀ¥á¡¼¥¸½¤Àµ
3276 * @param plus_bow µÝ¤Î¥À¥á¡¼¥¸½¤Àµ
3277 * @param dam ´ðËÜ¥À¥á¡¼¥¸ÎÌ
3278 * @return ¥À¥á¡¼¥¸´üÂÔÃÍ
3280 s16b calc_expect_crit_shot(int weight, int plus_ammo, int plus_bow, int dam)
3284 i = calc_crit_ratio_shot(weight, plus_ammo, plus_bow, dam);
3289 crit = MIN(500, 900/weight);
3290 num += dam * 3 /2 * crit;
3293 crit = MIN(500, 1350/weight);
3295 num += dam * 2 * crit;
3301 num += dam * 3 * crit;
3307 num += (10000 - i) * dam;
3314 * @brief ¹¶·â»þ¥¯¥ê¥Æ¥£¥«¥ë¤Ë¤è¤ë¥À¥á¡¼¥¸´üÂÔÃͽ¤Àµ·×»»¡Ê½ÅÎ̤ÈÆǿ˽èÍý¡Ë / critical happens at i / 10000
3315 * @param weight Éð´ï¤Î½ÅÎÌ
3316 * @param plus Éð´ï¤Î¥À¥á¡¼¥¸½¤Àµ
3317 * @param dam ´ðËÜ¥À¥á¡¼¥¸
3318 * @param meichuu Ì¿ÃæÃÍ
3319 * @param dokubari Æǿ˽èÍý¤«Èݤ«
3320 * @return ¥À¥á¡¼¥¸´üÂÔÃÍ
3322 s16b calc_expect_crit(int weight, int plus, int dam, s16b meichuu, bool dokubari)
3327 if(dokubari) return dam;
3329 i = (weight + (meichuu * 3 + plus * 5) + p_ptr->skill_thn);
3335 if (k < 400) num += (2 * dam + 5) * (400 - k);
3336 if (k < 700) num += (2 * dam + 10) * (MIN(700, k + 650) - MAX(400, k));
3337 if (k > (700 - 650) && k < 900) num += (3 * dam + 15) * (MIN(900, k + 650) - MAX(700, k));
3338 if (k > (900 - 650) && k < 1300) num += (3 * dam + 20) * (MIN(1300, k + 650) - MAX(900, k));
3339 if (k > (1300 - 650)) num += (7 * dam / 2 + 25) * MIN(650, k - (1300 - 650));
3342 if(p_ptr->pclass == CLASS_NINJA)
3345 num += (4444 - i) * dam;
3351 num += (5000 - i) * dam;
3359 * @brief ¹¶·â»þ¥¹¥ì¥¤¤Ë¤è¤ë¥À¥á¡¼¥¸´üÂÔÃͽ¤Àµ·×»» / critical happens at i / 10000
3360 * @param dam ´ðËÜ¥À¥á¡¼¥¸
3361 * @param mult ¥¹¥ì¥¤ÇÜΨ¡Ê³Ý¤±»»Éôʬ¡Ë
3362 * @param div ¥¹¥ì¥¤ÇÜΨ¡Ê³ä¤ê»»Éôʬ¡Ë
3363 * @param force ÍýÎÏÆÃÊÌ·×»»¥Õ¥é¥°
3364 * @return ¥À¥á¡¼¥¸´üÂÔÃÍ
3366 static s16b calc_slaydam(int dam, int mult, int div, bool force)
3374 tmp += dam * 60 * 2;
3388 * @brief ¹¶·â»þ¤Î´üÂÔÃÍ·×»»¡Ê¥¹¥ì¥¤¢ª½ÅÎÌ¥¯¥ê¥Æ¥£¥«¥ë¢ªÀÚ¤ìÌ£¸ú²Ì¡Ë
3389 * @param dam ´ðËÜ¥À¥á¡¼¥¸
3390 * @param mult ¥¹¥ì¥¤ÇÜΨ¡Ê³Ý¤±»»Éôʬ¡Ë
3391 * @param div ¥¹¥ì¥¤ÇÜΨ¡Ê³ä¤ê»»Éôʬ¡Ë
3392 * @param force ÍýÎÏÆÃÊÌ·×»»¥Õ¥é¥°
3393 * @param weight ½ÅÎÌ
3394 * @param plus Éð´ï¥À¥á¡¼¥¸½¤Àµ
3395 * @param meichuu Ì¿ÃæÃÍ
3396 * @param dokubari Æǿ˽èÍý¤«Èݤ«
3397 * @param vorpal_mult ÀÚ¤ìÌ£ÇÜΨ¡Ê³Ý¤±»»Éôʬ¡Ë
3398 * @param vorpal_div ÀÚ¤ìÌ£ÇÜΨ¡Ê³ä¤ê»»Éôʬ¡Ë
3399 * @return ¥À¥á¡¼¥¸´üÂÔÃÍ
3401 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)
3403 dam = calc_slaydam(dam, mult, div, force);
3404 dam = calc_expect_crit(weight, plus, dam, meichuu, dokubari);
3405 dam = calc_slaydam(dam, vorpal_mult, vorpal_div, FALSE);
3411 * @brief Éð´ï¤Î³Æ¾ò·ïËè¤Î¥À¥á¡¼¥¸´üÂÔÃͤòɽ¼¨¤¹¤ë¡£
3414 * @param mindice ¥À¥¤¥¹ÉôʬºÇ¾®ÃÍ
3415 * @param maxdice ¥À¥¤¥¹ÉôʬºÇÂçÃÍ
3416 * @param blows ¹¶·â²ó¿ô
3417 * @param dam_bonus ¥À¥á¡¼¥¸½¤ÀµÃÍ
3418 * @param attr ¾ò·ïÆâÍÆ
3419 * @param color ¾ò·ïÆâÍƤÎɽ¼¨¿§
3421 * Display the damage figure of an object\n
3422 * (used by compare_weapon_aux)\n
3424 * Only accurate for the current weapon, because it includes\n
3425 * the current +dam of the player.\n
3428 static void show_weapon_dmg(int r, int c, int mindice, int maxdice, int blows, int dam_bonus, cptr attr, byte color)
3433 mindam = blows * (mindice + dam_bonus);
3434 maxdam = blows * (maxdice + dam_bonus);
3436 /* Print the intro text */
3437 c_put_str(color, attr, r, c);
3439 /* Calculate the min and max damage figures */
3441 sprintf(tmp_str, "£±¥¿¡¼¥ó: %d-%d ¥À¥á¡¼¥¸",
3443 sprintf(tmp_str, "Attack: %d-%d damage",
3447 /* Print the damage */
3448 put_str(tmp_str, r, c + 8);
3453 * @brief Éð´ï°ì¤ÄËè¤Î¥À¥á¡¼¥¸¾ðÊó¤òɽ¼¨¤¹¤ë¡£
3454 * @param o_ptr ¥ª¥Ö¥¸¥§¥¯¥È¤Î¹½Â¤ÂΤλ²¾È¥Ý¥¤¥ó¥¿¡£
3455 * @param col ɽ¼¨¤¹¤ë¹Ô¤Î¾åü
3456 * @param r ɽ¼¨¤¹¤ëÎó¤Îº¸Ã¼
3458 * Show the damage figures for the various monster types\n
3460 * Only accurate for the current weapon, because it includes\n
3461 * the current number of blows for the player.\n
3464 static void compare_weapon_aux(object_type *o_ptr, int col, int r)
3466 u32b flgs[TR_FLAG_SIZE];
3467 int blow = p_ptr->num_blow[0];
3469 bool dokubari = FALSE;
3471 /* Effective dices */
3472 int eff_dd = o_ptr->dd + p_ptr->to_dd[0];
3473 int eff_ds = o_ptr->ds + p_ptr->to_ds[0];
3475 int mindice = eff_dd;
3476 int maxdice = eff_ds * eff_dd;
3479 int vorpal_mult = 1;
3481 int dmg_bonus = o_ptr->to_d + p_ptr->to_d[0];
3484 /* Get the flags of the weapon */
3485 object_flags(o_ptr, flgs);
3487 if((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) dokubari = TRUE;
3490 /* Show Critical Damage*/
3491 mindam = calc_expect_crit(o_ptr->weight, o_ptr->to_h, mindice, p_ptr->to_h[0], dokubari);
3492 maxdam = calc_expect_crit(o_ptr->weight, o_ptr->to_h, maxdice, p_ptr->to_h[0], dokubari);
3494 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("²ñ¿´:", "Critical:"), TERM_L_RED);
3498 if ((have_flag(flgs, TR_VORPAL) || hex_spelling(HEX_RUNESWORD)))
3500 if((o_ptr->name1 == ART_VORPAL_BLADE) || (o_ptr->name1 == ART_CHAINSWORD))
3511 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);
3512 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);
3513 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("ÀÚ¤ìÌ£:", "Vorpal:") , TERM_L_RED);
3516 if ((p_ptr->pclass != CLASS_SAMURAI) && have_flag(flgs, TR_FORCE_WEAPON) && (p_ptr->csp > (o_ptr->dd * o_ptr->ds / 5)))
3520 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);
3521 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);
3522 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("ÍýÎÏ:", "Force :"), TERM_L_BLUE);
3525 /* Print the relevant lines */
3526 if (have_flag(flgs, TR_KILL_ANIMAL))
3528 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);
3529 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);
3530 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("ưʪ:", "Animals:"), TERM_YELLOW);
3532 else if (have_flag(flgs, TR_SLAY_ANIMAL))
3534 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);
3535 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);
3536 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("ưʪ:", "Animals:"), TERM_YELLOW);
3538 if (have_flag(flgs, TR_KILL_EVIL))
3540 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);
3541 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);
3542 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("¼Ù°:", "Evil:"), TERM_YELLOW);
3544 else if (have_flag(flgs, TR_SLAY_EVIL))
3546 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);
3547 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);
3548 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("¼Ù°:", "Evil:"), TERM_YELLOW);
3550 if (have_flag(flgs, TR_KILL_HUMAN))
3552 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);
3553 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);
3554 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("¿Í´Ö:", "Human:"), TERM_YELLOW);
3556 else if (have_flag(flgs, TR_SLAY_HUMAN))
3558 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);
3559 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);
3560 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("¿Í´Ö:", "Human:"), TERM_YELLOW);
3562 if (have_flag(flgs, TR_KILL_UNDEAD))
3564 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);
3565 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);
3566 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("ÉÔ»à:", "Undead:"), TERM_YELLOW);
3568 else if (have_flag(flgs, TR_SLAY_UNDEAD))
3570 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);
3571 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);
3572 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("ÉÔ»à:", "Undead:"), TERM_YELLOW);
3574 if (have_flag(flgs, TR_KILL_DEMON))
3576 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);
3577 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);
3578 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("°Ëâ:", "Demons:") , TERM_YELLOW);
3580 else if (have_flag(flgs, TR_SLAY_DEMON))
3582 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);
3583 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);
3584 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("°Ëâ:", "Demons:") , TERM_YELLOW);
3586 if (have_flag(flgs, TR_KILL_ORC))
3588 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);
3589 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);
3590 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("¥ª¡¼¥¯:", "Orcs:"), TERM_YELLOW);
3592 else if (have_flag(flgs, TR_SLAY_ORC))
3594 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);
3595 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);
3596 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("¥ª¡¼¥¯:", "Orcs:"), TERM_YELLOW);
3598 if (have_flag(flgs, TR_KILL_TROLL))
3600 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);
3601 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);
3602 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("¥È¥í¥ë:", "Trolls:") , TERM_YELLOW);
3604 else if (have_flag(flgs, TR_SLAY_TROLL))
3606 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);
3607 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);
3608 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("¥È¥í¥ë:", "Trolls:") , TERM_YELLOW);
3610 if (have_flag(flgs, TR_KILL_GIANT))
3612 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);
3613 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);
3614 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("µð¿Í:", "Giants:"), TERM_YELLOW);
3616 else if (have_flag(flgs, TR_SLAY_GIANT))
3618 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);
3619 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);
3620 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("µð¿Í:", "Giants:"), TERM_YELLOW);
3622 if (have_flag(flgs, TR_KILL_DRAGON))
3624 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);
3625 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);
3626 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("ε:", "Dragons:"), TERM_YELLOW);
3628 else if (have_flag(flgs, TR_SLAY_DRAGON))
3630 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);
3631 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);
3632 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("ε:", "Dragons:"), TERM_YELLOW);
3634 if (have_flag(flgs, TR_BRAND_ACID))
3636 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);
3637 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);
3638 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("»À°À:", "Acid:"), TERM_RED);
3640 if (have_flag(flgs, TR_BRAND_ELEC))
3642 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);
3643 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);
3644 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("ÅÅ°À:", "Elec:"), TERM_RED);
3646 if (have_flag(flgs, TR_BRAND_FIRE))
3648 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);
3649 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);
3650 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("±ê°À:", "Fire:"), TERM_RED);
3652 if (have_flag(flgs, TR_BRAND_COLD))
3654 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);
3655 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);
3656 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("Îä°À:", "Cold:"), TERM_RED);
3658 if (have_flag(flgs, TR_BRAND_POIS))
3660 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);
3661 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);
3662 show_weapon_dmg(r++, col, mindam, maxdam, blow, dmg_bonus, _("ÆÇ°À:", "Poison:"), TERM_RED);
3667 * @brief ¥â¥ó¥¹¥¿¡¼¤Ø¤ÎÌ¿ÃæΨ¤Î·×»»
3668 * @param to_h Ì¿ÃæÃÍ
3672 static int hit_chance(int to_h, int ac)
3675 int meichuu = p_ptr->skill_thn + (p_ptr->to_h[0] + to_h) * BTH_PLUS_ADJ;
3677 if (meichuu <= 0) return 5;
3679 chance = 100 - ((ac * 75) / meichuu);
3681 if (chance > 95) chance = 95;
3682 if (chance < 5) chance = 5;
3683 if (p_ptr->pseikaku == SEIKAKU_NAMAKE)
3684 chance = (chance*19+9)/20;
3689 * @brief Éð´ï¾¢¤Ë¤ª¤±¤ëÉð´ï°ì¤ÄËè¤Î´°Á´¾ðÊó¤òɽ¼¨¤¹¤ë¡£
3690 * @param o_ptr ¥ª¥Ö¥¸¥§¥¯¥È¤Î¹½Â¤ÂΤλ²¾È¥Ý¥¤¥ó¥¿¡£
3691 * @param row ɽ¼¨¤¹¤ëÎó¤Îº¸Ã¼
3692 * @param col ɽ¼¨¤¹¤ë¹Ô¤Î¾åü
3694 * Displays all info about a weapon
3696 * Only accurate for the current weapon, because it includes
3697 * various info about the player's +to_dam and number of blows.
3700 static void list_weapon(object_type *o_ptr, int row, int col)
3702 char o_name[MAX_NLEN];
3705 /* Effective dices */
3706 int eff_dd = o_ptr->dd + p_ptr->to_dd[0];
3707 int eff_ds = o_ptr->ds + p_ptr->to_ds[0];
3709 /* Print the weapon name */
3710 object_desc(o_name, o_ptr, OD_NAME_ONLY);
3711 c_put_str(TERM_YELLOW, o_name, row, col);
3713 /* Print the player's number of blows */
3715 sprintf(tmp_str, "¹¶·â²ó¿ô: %d", p_ptr->num_blow[0]);
3717 sprintf(tmp_str, "Number of Blows: %d", p_ptr->num_blow[0]);
3720 put_str(tmp_str, row+1, col);
3722 /* Print to_hit and to_dam of the weapon */
3724 sprintf(tmp_str, "Ì¿ÃæΨ: 0 50 100 150 200 (Ũ¤ÎAC)");
3726 sprintf(tmp_str, "To Hit: 0 50 100 150 200 (AC)");
3729 put_str(tmp_str, row+2, col);
3731 /* Print the weapons base damage dice */
3733 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));
3735 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));
3738 put_str(tmp_str, row+3, col);
3741 c_put_str(TERM_YELLOW, "²Äǽ¤Ê¥À¥á¡¼¥¸:", row+5, col);
3743 c_put_str(TERM_YELLOW, "Possible Damage:", row+5, col);
3747 /* Damage for one blow (if it hits) */
3749 sprintf(tmp_str, "¹¶·â°ì²ó¤Ë¤Ä¤ %d-%d",
3751 sprintf(tmp_str, "One Strike: %d-%d damage",
3754 eff_dd + o_ptr->to_d + p_ptr->to_d[0],
3755 eff_ds * eff_dd + o_ptr->to_d + p_ptr->to_d[0]);
3756 put_str(tmp_str, row+6, col+1);
3758 /* Damage for the complete attack (if all blows hit) */
3760 sprintf(tmp_str, "£±¥¿¡¼¥ó¤Ë¤Ä¤ %d-%d",
3762 sprintf(tmp_str, "One Attack: %d-%d damage",
3765 p_ptr->num_blow[0] * (eff_dd + o_ptr->to_d + p_ptr->to_d[0]),
3766 p_ptr->num_blow[0] * (eff_ds * eff_dd + o_ptr->to_d + p_ptr->to_d[0]));
3767 put_str(tmp_str, row+7, col+1);
3772 * @brief Éð´ï¾¢¤Î¡ÖÉð´ï¡×´ÕÄêÂоݤˤʤ뤫¤òȽÄꤹ¤ë¡£/ Hook to specify "weapon"
3773 * @param o_ptr ¥ª¥Ö¥¸¥§¥¯¥È¤Î¹½Â¤ÂΤλ²¾È¥Ý¥¤¥ó¥¿¡£
3774 * @return Âоݤˤʤë¤Ê¤éTRUE¤òÊÖ¤¹¡£
3776 static bool item_tester_hook_melee_weapon(object_type *o_ptr)
3778 switch (o_ptr->tval)
3788 if (o_ptr->sval != SV_DOKUBARI) return (TRUE);
3797 * @brief Éð´ï¾¢¤Î¡ÖÌðÃơ״ÕÄêÂоݤˤʤ뤫¤òȽÄꤹ¤ë¡£/ Hook to specify "weapon"
3798 * @param o_ptr ¥ª¥Ö¥¸¥§¥¯¥È¤Î¹½Â¤ÂΤλ²¾È¥Ý¥¤¥ó¥¿¡£
3799 * @return Âоݤˤʤë¤Ê¤éTRUE¤òÊÖ¤¹¡£
3801 static bool item_tester_hook_ammo(object_type *o_ptr)
3803 switch (o_ptr->tval)
3818 * @brief Éð´ï¾¢´ÕÄ꣱²óʬ¡Ê¥ª¥Ö¥¸¥§¥¯¥È£²¼ï¡Ë¤Î½èÍý¡£/ Compare weapons
3820 * Copies the weapons to compare into the weapon-slot and\n
3821 * compares the values for both weapons.\n
3822 * Éð´ï£±¤Ä¤À¤±¤ÇÈæ³Ó¤ò¤·¤Ê¤¤¤Ê¤éÈñÍѤÏȾ³Û¤Ë¤Ê¤ë¡£
3823 * @param bcost ´ðËÜ´ÕÄêÈñÍÑ
3824 * @return ºÇ½ªÅª¤Ë¤«¤«¤Ã¤¿ÈñÍÑ
3826 static int compare_weapons(int bcost)
3830 object_type *o_ptr[2];
3831 object_type orig_weapon;
3835 int wid = 38, mgn = 2;
3836 bool old_character_xtra = character_xtra;
3839 int cost = 0; /* First time no price */
3841 /* Save the screen */
3844 /* Clear the screen */
3847 /* Store copy of original wielded weapon */
3848 i_ptr = &inventory[INVEN_RARM];
3849 object_copy(&orig_weapon, i_ptr);
3851 /* Only compare melee weapons */
3852 item_tester_no_ryoute = TRUE;
3853 item_tester_hook = item_tester_hook_melee_weapon;
3855 /* Get the first weapon */
3856 q = _("Âè°ì¤ÎÉð´ï¤Ï¡©", "What is your first weapon? ");
3857 s = _("Èæ¤Ù¤ë¤â¤Î¤¬¤¢¤ê¤Þ¤»¤ó¡£", "You have nothing to compare.");
3859 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN)))
3865 /* Get the item (in the pack) */
3866 o_ptr[0] = &inventory[item];
3872 /* Clear the screen */
3875 /* Only compare melee weapons */
3876 item_tester_no_ryoute = TRUE;
3877 item_tester_hook = item_tester_hook_melee_weapon;
3879 /* Hack -- prevent "icky" message */
3880 character_xtra = TRUE;
3882 /* Diaplay selected weapon's infomation */
3883 for (i = 0; i < n; i++)
3885 int col = (wid * i + mgn);
3887 /* Copy i-th weapon into the weapon slot (if it's not already there) */
3888 if (o_ptr[i] != i_ptr) object_copy(i_ptr, o_ptr[i]);
3890 /* Get the new values */
3893 /* List the new values */
3894 list_weapon(o_ptr[i], row, col);
3895 compare_weapon_aux(o_ptr[i], col, row + 8);
3897 /* Copy back the original weapon into the weapon slot */
3898 object_copy(i_ptr, &orig_weapon);
3901 /* Reset the values for the old weapon */
3904 character_xtra = old_character_xtra;
3907 put_str(format("[ Èæ³ÓÂоÝ: 's'¤ÇÊѹ¹ ($%d) ]", cost), 1, (wid + mgn));
3908 put_str("(°ìÈֹ⤤¥À¥á¡¼¥¸¤¬Å¬ÍѤµ¤ì¤Þ¤¹¡£Ê£¿ô¤ÎÇÜÂǸú²Ì¤Ï¤·»»¤µ¤ì¤Þ¤»¤ó¡£)", row + 4, 0);
3909 prt("¸½ºß¤Îµ»Î̤«¤éȽÃǤ¹¤ë¤È¡¢¤¢¤Ê¤¿¤ÎÉð´ï¤Ï°Ê²¼¤Î¤è¤¦¤Ê°ÒÎϤòȯ´ø¤·¤Þ¤¹:", 0, 0);
3911 put_str(format("[ 's' Select secondary weapon($%d) ]", cost), row + 1, (wid * i + mgn));
3912 put_str("(Only highest damage applies per monster. Special damage not cumulative.)", row + 4, 0);
3913 prt("Based on your current abilities, here is what your weapons will do", 0, 0);
3921 if (total + cost > p_ptr->au)
3923 msg_print(_("¤ª¶â¤¬Â¤ê¤Þ¤»¤ó¡ª", "You don't have enough money!"));
3928 q = _("ÂèÆó¤ÎÉð´ï¤Ï¡©", "What is your second weapon? ");
3929 s = _("Èæ¤Ù¤ë¤â¤Î¤¬¤¢¤ê¤Þ¤»¤ó¡£", "You have nothing to compare.");
3931 /* Get the second weapon */
3932 if (!get_item(&item2, q, s, (USE_EQUIP | USE_INVEN))) continue;
3937 /* Get the item (in the pack) */
3938 o_ptr[1] = &inventory[item2];
3947 /* Restore the screen */
3956 * @brief AC¤«¤é²óÈòΨ¡¢¥À¥á¡¼¥¸¸º¾¯Î¨¤ò·×»»¤·É½¼¨¤¹¤ë¡£ / Evaluate AC
3958 * Calculate and display the dodge-rate and the protection-rate
3960 * @param iAC ¥×¥ì¥¤¥ä¡¼¤ÎAC¡£
3961 * @return ¾ï¤ËTRUE¤òÊÖ¤¹¡£
3963 static bool eval_ac(int iAC)
3967 "¥À¥á¡¼¥¸·Ú¸ºÎ¨¤È¤Ï¡¢Å¨¤Î¹¶·â¤¬Åö¤¿¤Ã¤¿»þ¤½¤Î¥À¥á¡¼¥¸¤ò\n"
3968 "²¿¥Ñ¡¼¥»¥ó¥È·Ú¸º¤¹¤ë¤«¤ò¼¨¤·¤Þ¤¹¡£\n"
3969 "¥À¥á¡¼¥¸·Ú¸º¤ÏÄ̾ï¤ÎľÀܹ¶·â(¼ïÎब¡Ö¹¶·â¤¹¤ë¡×¤È¡ÖÊ´ºÕ¤¹¤ë¡×¤Îʪ)\n"
3970 "¤ËÂФ·¤Æ¤Î¤ß¸ú²Ì¤¬¤¢¤ê¤Þ¤¹¡£\n \n"
3971 "Ũ¤Î¥ì¥Ù¥ë¤È¤Ï¡¢¤½¤ÎŨ¤¬Ä̾ﲿ³¬¤Ë¸½¤ì¤ë¤«¤ò¼¨¤·¤Þ¤¹¡£\n \n"
3972 "²óÈòΨ¤ÏŨ¤ÎľÀܹ¶·â¤ò²¿¥Ñ¡¼¥»¥ó¥È¤Î³ÎΨ¤ÇÈò¤±¤ë¤«¤ò¼¨¤·¡¢\n"
3973 "Ũ¤Î¥ì¥Ù¥ë¤È¤¢¤Ê¤¿¤ÎAC¤Ë¤è¤Ã¤Æ·èÄꤵ¤ì¤Þ¤¹¡£\n \n"
3974 "¥À¥á¡¼¥¸´üÂÔÃͤȤϡ¢Å¨¤Î£±£°£°¥Ý¥¤¥ó¥È¤ÎÄ̾ﹶ·â¤ËÂФ·¡¢\n"
3975 "²óÈòΨ¤È¥À¥á¡¼¥¸·Ú¸ºÎ¨¤ò¹Íθ¤·¤¿¥À¥á¡¼¥¸¤Î´üÂÔÃͤò¼¨¤·¤Þ¤¹¡£\n";
3978 "'Protection Rate' means how much damage is reduced by your armor.\n"
3979 "Note that the Protection rate is effective only against normal "
3980 "'attack' and 'shatter' type melee attacks, "
3981 "and has no effect against any other types such as 'poison'.\n \n"
3982 "'Dodge Rate' indicates the success rate on dodging the "
3983 "monster's melee attacks. "
3984 "It is depend on the level of the monster and your AC.\n \n"
3985 "'Average Damage' indicates the expected amount of damage "
3986 "when you are attacked by normal melee attacks with power=100.";
3992 char buf[80*20], *t;
3994 /* AC lower than zero has no effect */
3995 if (iAC < 0) iAC = 0;
3997 /* ¥À¥á¡¼¥¸·Ú¸ºÎ¨¤ò·×»» */
3998 protection = 100 * MIN(iAC, 150) / 250;
4004 put_str(format("¤¢¤Ê¤¿¤Î¸½ºß¤ÎAC: %3d", iAC), row++, 0);
4005 put_str(format("¥À¥á¡¼¥¸·Ú¸ºÎ¨ : %3d%%", protection), row++, 0);
4008 put_str("Ũ¤Î¥ì¥Ù¥ë :", row + 0, 0);
4009 put_str("²óÈòΨ :", row + 1, 0);
4010 put_str("¥À¥á¡¼¥¸´üÂÔÃÍ :", row + 2, 0);
4012 put_str(format("Your current AC : %3d", iAC), row++, 0);
4013 put_str(format("Protection rate : %3d%%", protection), row++, 0);
4016 put_str("Level of Monster:", row + 0, 0);
4017 put_str("Dodge Rate :", row + 1, 0);
4018 put_str("Average Damage :", row + 2, 0);
4021 for (col = 17 + 1, lvl = 0; lvl <= 100; lvl += 10, col += 5)
4023 int quality = 60 + lvl * 3; /* attack quality with power 60 */
4024 int dodge; /* ²óÈòΨ(%) */
4025 int average; /* ¥À¥á¡¼¥¸´üÂÔÃÍ */
4027 put_str(format("%3d", lvl), row + 0, col);
4030 dodge = 5 + (MIN(100, 100 * (iAC * 3 / 4) / quality) * 9 + 5) / 10;
4031 put_str(format("%3d%%", dodge), row + 1, col);
4033 /* 100ÅÀ¤Î¹¶·â¤ËÂФ·¤Æ¤Î¥À¥á¡¼¥¸´üÂÔÃͤò·×»» */
4034 average = (100 - dodge) * (100 - protection) / 100;
4035 put_str(format("%3d", average), row + 2, col);
4039 roff_to_buf(memo, 70, buf, sizeof(buf));
4040 for (t = buf; t[0]; t += strlen(t) + 1)
4041 put_str(t, (row++) + 4, 4);
4044 prt("¸½ºß¤Î¤¢¤Ê¤¿¤ÎÁõÈ÷¤«¤é¤¹¤ë¤È¡¢¤¢¤Ê¤¿¤ÎËɸæÎϤÏ"
4045 "¤³¤ì¤¯¤é¤¤¤Ç¤¹:", 0, 0);
4047 prt("Defense abilities from your current Armor Class are evaluated below.", 0, 0);
4060 * @brief ½¤ÉüÂоݤȤʤë²õ¤ì¤¿Éð´ï¤«¤òȽÄꤹ¤ë¡£ / Hook to specify "broken weapon"
4061 * @param o_ptr ¥ª¥Ö¥¸¥§¥¯¥È¤Î¹½Â¤ÂΤλ²¾È¥Ý¥¤¥ó¥¿¡£
4062 * @return ½¤ÉüÂоݤˤʤë¤Ê¤éTRUE¤òÊÖ¤¹¡£
4064 static bool item_tester_hook_broken_weapon(object_type *o_ptr)
4066 if (o_ptr->tval != TV_SWORD) return FALSE;
4068 switch (o_ptr->sval)
4070 case SV_BROKEN_DAGGER:
4071 case SV_BROKEN_SWORD:
4079 * @brief ½¤ÉüºàÎÁ¤Î¥ª¥Ö¥¸¥§¥¯¥È¤«¤é½¤ÉüÂоݤËÆÃÀ¤ò°Ü¿¢¤¹¤ë¡£
4080 * @param to_ptr ½¤ÉüÂоݥª¥Ö¥¸¥§¥¯¥È¤Î¹½Â¤ÂΤλ²¾È¥Ý¥¤¥ó¥¿¡£
4081 * @param from_ptr ½¤ÉüºàÎÁ¥ª¥Ö¥¸¥§¥¯¥È¤Î¹½Â¤ÂΤλ²¾È¥Ý¥¤¥ó¥¿¡£
4082 * @return ½¤ÉüÂоݤˤʤë¤Ê¤éTRUE¤òÊÖ¤¹¡£
4084 static void give_one_ability_of_object(object_type *to_ptr, object_type *from_ptr)
4087 int cand[TR_FLAG_MAX];
4088 u32b to_flgs[TR_FLAG_SIZE];
4089 u32b from_flgs[TR_FLAG_SIZE];
4091 object_flags(to_ptr, to_flgs);
4092 object_flags(from_ptr, from_flgs);
4094 for (i = 0; i < TR_FLAG_MAX; i++)
4098 case TR_IGNORE_ACID:
4099 case TR_IGNORE_ELEC:
4100 case TR_IGNORE_FIRE:
4101 case TR_IGNORE_COLD:
4110 case TR_FIXED_FLAVOR:
4113 if (have_flag(from_flgs, i) && !have_flag(to_flgs, i))
4115 if (!(is_pval_flag(i) && (from_ptr->pval < 1))) cand[n++] = i;
4123 int tr_idx = cand[randint0(n)];
4124 add_flag(to_ptr->art_flags, tr_idx);
4125 if (is_pval_flag(tr_idx)) to_ptr->pval = MAX(to_ptr->pval, 1);
4126 bmax = MIN(3, MAX(1, 40 / (to_ptr->dd * to_ptr->ds)));
4127 if (tr_idx == TR_BLOWS) to_ptr->pval = MIN(to_ptr->pval, bmax);
4128 if (tr_idx == TR_SPEED) to_ptr->pval = MIN(to_ptr->pval, 4);
4135 * @brief ¥¢¥¤¥Æ¥à½¤Éü½èÍý¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó / Repair broken weapon
4136 * @param bcost ´ðËÜ´ÕÄêÈñÍÑ
4137 * @return ¼ÂºÝ¤Ë¤«¤«¤Ã¤¿ÈñÍÑ
4139 static int repair_broken_weapon_aux(int bcost)
4143 object_type *o_ptr, *mo_ptr; /* broken weapon and material weapon */
4145 int i, k_idx, dd_bonus, ds_bonus;
4146 char basenm[MAX_NLEN];
4147 cptr q, s; /* For get_item prompt */
4154 prt(_("½¤Éü¤Ë¤ÏºàÎÁ¤È¤Ê¤ë¤â¤¦1¤Ä¤ÎÉð´ï¤¬É¬ÍפǤ¹¡£", "Hand one material weapon to repair a broken weapon."), row, 2);
4155 prt(_("ºàÎÁ¤Ë»ÈÍѤ·¤¿Éð´ï¤Ï¤Ê¤¯¤Ê¤ê¤Þ¤¹¡ª", "The material weapon will disappear after repairing!!"), row+1, 2);
4158 q = _("¤É¤ÎÀޤ줿Éð´ï¤ò½¤Éü¤·¤Þ¤¹¤«¡©", "Repair which broken weapon? ");
4159 s = _("½¤Éü¤Ç¤¤ëÀޤ줿Éð´ï¤¬¤¢¤ê¤Þ¤»¤ó¡£", "You have no broken weapon to repair.");
4161 /* Only forge broken weapons */
4162 item_tester_hook = item_tester_hook_broken_weapon;
4164 if (!get_item(&item, q, s, (USE_INVEN | USE_EQUIP))) return (0);
4166 /* Get the item (in the pack) */
4167 o_ptr = &inventory[item];
4169 /* It is worthless */
4170 if (!object_is_ego(o_ptr) && !object_is_artifact(o_ptr))
4172 msg_format(_("¤½¤ì¤Ïľ¤·¤Æ¤â¤·¤ç¤¦¤¬¤Ê¤¤¤¼¡£", "It is worthless to repair."));
4176 /* They are too many */
4177 if (o_ptr->number > 1)
4179 msg_format(_("°ìÅÙ¤ËÊ£¿ô¤ò½¤Éü¤¹¤ë¤³¤È¤Ï¤Ç¤¤Þ¤»¤ó¡ª", "They are too many to repair at once!"));
4183 /* Display item name */
4184 object_desc(basenm, o_ptr, OD_NAME_ONLY);
4185 prt(format(_("½¤Éü¤¹¤ëÉð´ï¡¡¡§ %s", "Repairing: %s"), basenm), row+3, 2);
4188 q = _("ºàÎÁ¤È¤Ê¤ëÉð´ï¤Ï¡©", "Which weapon for material? ");
4189 s = _("ºàÎÁ¤È¤Ê¤ëÉð´ï¤¬¤¢¤ê¤Þ¤»¤ó¡£", "You have no material to repair.");
4191 /* Only forge broken weapons */
4192 item_tester_hook = item_tester_hook_melee_weapon;
4194 if (!get_item(&mater, q, s, (USE_INVEN | USE_EQUIP))) return (0);
4197 msg_print(_("¥¯¥é¥¤¥ó¤ÎÄÛ¤¸¤ã¤Ê¤¤¡ª", "This is not a klein bottle!"));
4201 /* Get the item (in the pack) */
4202 mo_ptr = &inventory[mater];
4204 /* Display item name */
4205 object_desc(basenm, mo_ptr, OD_NAME_ONLY);
4206 prt(format(_("ºàÎÁ¤È¤¹¤ëÉð´ï¡§ %s", "Material : %s"), basenm), row+4, 2);
4208 /* Get the value of one of the items (except curses) */
4209 cost = bcost + object_value_real(o_ptr) * 2;
4212 if (!get_check(format("¡ð%d¤«¤«¤ê¤Þ¤¹¤¬¤è¤í¤·¤¤¤Ç¤¹¤«¡© ", cost))) return (0);
4214 if (!get_check(format("Costs %d gold, okay? ", cost))) return (0);
4217 /* Check if the player has enough money */
4218 if (p_ptr->au < cost)
4220 object_desc(basenm, o_ptr, OD_NAME_ONLY);
4221 msg_format(_("%s¤ò½¤Éü¤¹¤ë¤À¤±¤Î¥´¡¼¥ë¥É¤¬¤¢¤ê¤Þ¤»¤ó¡ª",
4222 "You do not have the gold to repair %s!"), basenm);
4227 if (o_ptr->sval == SV_BROKEN_DAGGER)
4231 /* Suppress compiler warning */
4234 for (i = 1; i < max_k_idx; i++)
4236 object_kind *k_ptr = &k_info[i];
4238 if (k_ptr->tval != TV_SWORD) continue;
4239 if ((k_ptr->sval == SV_BROKEN_DAGGER) ||
4240 (k_ptr->sval == SV_BROKEN_SWORD) ||
4241 (k_ptr->sval == SV_DOKUBARI)) continue;
4242 if (k_ptr->weight > 99) continue;
4251 else /* TV_BROKEN_SWORD */
4253 /* Repair to a sword or sometimes material's type weapon */
4254 int tval = (one_in_(5) ? mo_ptr->tval : TV_SWORD);
4258 object_kind *ck_ptr;
4260 k_idx = lookup_kind(tval, SV_ANY);
4261 ck_ptr = &k_info[k_idx];
4263 if (tval == TV_SWORD)
4265 if ((ck_ptr->sval == SV_BROKEN_DAGGER) ||
4266 (ck_ptr->sval == SV_BROKEN_SWORD) ||
4267 (ck_ptr->sval == SV_DIAMOND_EDGE) ||
4268 (ck_ptr->sval == SV_DOKUBARI)) continue;
4270 if (tval == TV_POLEARM)
4272 if ((ck_ptr->sval == SV_DEATH_SCYTHE) ||
4273 (ck_ptr->sval == SV_TSURIZAO)) continue;
4275 if (tval == TV_HAFTED)
4277 if ((ck_ptr->sval == SV_GROND) ||
4278 (ck_ptr->sval == SV_WIZSTAFF) ||
4279 (ck_ptr->sval == SV_NAMAKE_HAMMER)) continue;
4286 /* Calculate dice bonuses */
4287 dd_bonus = o_ptr->dd - k_info[o_ptr->k_idx].dd;
4288 ds_bonus = o_ptr->ds - k_info[o_ptr->k_idx].ds;
4289 dd_bonus += mo_ptr->dd - k_info[mo_ptr->k_idx].dd;
4290 ds_bonus += mo_ptr->ds - k_info[mo_ptr->k_idx].ds;
4292 /* Change base object */
4293 k_ptr = &k_info[k_idx];
4294 o_ptr->k_idx = k_idx;
4295 o_ptr->weight = k_ptr->weight;
4296 o_ptr->tval = k_ptr->tval;
4297 o_ptr->sval = k_ptr->sval;
4298 o_ptr->dd = k_ptr->dd;
4299 o_ptr->ds = k_ptr->ds;
4301 /* Copy base object's ability */
4302 for (i = 0; i < TR_FLAG_SIZE; i++) o_ptr->art_flags[i] |= k_ptr->flags[i];
4303 if (k_ptr->pval) o_ptr->pval = MAX(o_ptr->pval, randint1(k_ptr->pval));
4304 if (have_flag(k_ptr->flags, TR_ACTIVATE)) o_ptr->xtra2 = k_ptr->act_idx;
4310 for (i = 0; i < dd_bonus; i++)
4312 if (one_in_(o_ptr->dd + i)) o_ptr->dd++;
4318 for (i = 0; i < ds_bonus; i++)
4320 if (one_in_(o_ptr->ds + i)) o_ptr->ds++;
4325 if (have_flag(k_ptr->flags, TR_BLOWS))
4327 int bmax = MIN(3, MAX(1, 40 / (o_ptr->dd * o_ptr->ds)));
4328 o_ptr->pval = MIN(o_ptr->pval, bmax);
4331 /* Add one random ability from material weapon */
4332 give_one_ability_of_object(o_ptr, mo_ptr);
4334 /* Add to-dam, to-hit and to-ac from material weapon */
4335 o_ptr->to_d += MAX(0, (mo_ptr->to_d / 3));
4336 o_ptr->to_h += MAX(0, (mo_ptr->to_h / 3));
4337 o_ptr->to_a += MAX(0, (mo_ptr->to_a));
4339 if ((o_ptr->name1 == ART_NARSIL) ||
4340 (object_is_random_artifact(o_ptr) && one_in_(1)) ||
4341 (object_is_ego(o_ptr) && one_in_(7)))
4344 if (object_is_ego(o_ptr))
4346 add_flag(o_ptr->art_flags, TR_IGNORE_FIRE);
4347 add_flag(o_ptr->art_flags, TR_IGNORE_ACID);
4350 /* Add one random ability from material weapon */
4351 give_one_ability_of_object(o_ptr, mo_ptr);
4353 /* Add one random activation */
4354 if (!activation_index(o_ptr)) one_activation(o_ptr);
4357 if (o_ptr->name1 == ART_NARSIL)
4359 one_high_resistance(o_ptr);
4363 msg_print(_("¤³¤ì¤Ï¤«¤Ê¤ê¤Î¶Èʪ¤À¤Ã¤¿¤è¤¦¤À¡£", "This blade seems to be exceptionally."));
4366 object_desc(basenm, o_ptr, OD_NAME_ONLY);
4368 msg_format("¡ð%d¤Ç%s¤Ë½¤Éü¤·¤Þ¤·¤¿¡£", cost, basenm);
4370 msg_format("Repaired into %s for %d gold.", basenm, cost);
4374 /* Remove BROKEN flag */
4375 o_ptr->ident &= ~(IDENT_BROKEN);
4377 /* Add repaired flag */
4378 o_ptr->discount = 99;
4380 /* Decrease material object */
4381 inven_item_increase(mater, -1);
4382 inven_item_optimize(mater);
4385 p_ptr->update |= PU_BONUS;
4388 /* Something happened */
4393 * @brief ¥¢¥¤¥Æ¥à½¤Éü½èÍý¤Î²áÅϥ롼¥Á¥ó / Repair broken weapon
4394 * @param bcost ´ðËÜ´ÕÄêÈñÍÑ
4395 * @return ¼ÂºÝ¤Ë¤«¤«¤Ã¤¿ÈñÍÑ
4397 static int repair_broken_weapon(int bcost)
4402 cost = repair_broken_weapon_aux(bcost);
4409 * @brief ¥¢¥¤¥Æ¥à¤Î¶¯²½¤ò¹Ô¤¦¡£ / Enchant item
4410 * @param cost £±²óËè¤ÎÈñÍÑ
4411 * @to_hit Ì¿Ãæ¤ò¥¢¥Ã¥×¤µ¤»¤ëÎÌ
4412 * @to_dam ¥À¥á¡¼¥¸¤ò¥¢¥Ã¥×¤µ¤»¤ëÎÌ
4413 * @to_ac £Á£Ã¤ò¥¢¥Ã¥×¤µ¤»¤ëÎÌ
4414 * @return ¼ÂºÝ¤Ë¤«¤«¤Ã¤¿ÈñÍÑ
4416 static bool enchant_item(int cost, int to_hit, int to_dam, int to_ac)
4422 int maxenchant = (p_ptr->lev / 5);
4423 char tmp_str[MAX_NLEN];
4427 prt(format("¸½ºß¤Î¤¢¤Ê¤¿¤Îµ»Î̤À¤È¡¢+%d ¤Þ¤Ç²þÎɤǤ¤Þ¤¹¡£", maxenchant), 5, 0);
4428 prt(format(" ²þÎɤÎÎÁ¶â¤Ï°ì¸Ä¤Ë¤Ä¤¡ð%d ¤Ç¤¹¡£", cost), 7, 0);
4430 prt(format(" Based on your skill, we can improve up to +%d.", maxenchant), 5, 0);
4431 prt(format(" The price for the service is %d gold per item.", cost), 7, 0);
4434 item_tester_no_ryoute = TRUE;
4438 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò²þÎɤ·¤Þ¤¹¤«¡©";
4439 s = "²þÎɤǤ¤ë¤â¤Î¤¬¤¢¤ê¤Þ¤»¤ó¡£";
4441 q = "Improve which item? ";
4442 s = "You have nothing to improve.";
4445 if (!get_item(&item, q, s, (USE_INVEN | USE_EQUIP))) return (FALSE);
4447 /* Get the item (in the pack) */
4448 o_ptr = &inventory[item];
4450 /* Check if the player has enough money */
4451 if (p_ptr->au < (cost * o_ptr->number))
4453 object_desc(tmp_str, o_ptr, OD_NAME_ONLY);
4455 msg_format("%s¤ò²þÎɤ¹¤ë¤À¤±¤Î¥´¡¼¥ë¥É¤¬¤¢¤ê¤Þ¤»¤ó¡ª", tmp_str);
4457 msg_format("You do not have the gold to improve %s!", tmp_str);
4463 /* Enchant to hit */
4464 for (i = 0; i < to_hit; i++)
4466 if (o_ptr->to_h < maxenchant)
4468 if (enchant(o_ptr, 1, (ENCH_TOHIT | ENCH_FORCE)))
4476 /* Enchant to damage */
4477 for (i = 0; i < to_dam; i++)
4479 if (o_ptr->to_d < maxenchant)
4481 if (enchant(o_ptr, 1, (ENCH_TODAM | ENCH_FORCE)))
4490 for (i = 0; i < to_ac; i++)
4492 if (o_ptr->to_a < maxenchant)
4494 if (enchant(o_ptr, 1, (ENCH_TOAC | ENCH_FORCE)))
4506 if (flush_failure) flush();
4510 msg_print("²þÎɤ˼ºÇÔ¤·¤¿¡£");
4512 msg_print("The improvement failed.");
4519 object_desc(tmp_str, o_ptr, OD_NAME_AND_ENCHANT);
4521 msg_format("¡ð%d¤Ç%s¤Ë²þÎɤ·¤Þ¤·¤¿¡£", cost * o_ptr->number, tmp_str);
4523 msg_format("Improved into %s for %d gold.", tmp_str, cost * o_ptr->number);
4526 /* Charge the money */
4527 p_ptr->au -= (cost * o_ptr->number);
4529 if (item >= INVEN_RARM) calc_android_exp();
4531 /* Something happened */
4538 * @brief ËâÆ»¶ñ¤Î»ÈÍѲó¿ô¤ò²óÉü¤µ¤»¤ë»ÜÀߤΥᥤ¥ó¥ë¡¼¥Á¥ó / Recharge rods, wands and staves
4540 * The player can select the number of charges to add\n
4541 * (up to a limit), and the recharge never fails.\n
4543 * The cost for rods depends on the level of the rod. The prices\n
4544 * for recharging wands and staves are dependent on the cost of\n
4548 static void building_recharge(void)
4557 char tmp_str[MAX_NLEN];
4561 /* Display some info */
4564 prt(" ºÆ½¼Å¶¤ÎÈñÍѤϥ¢¥¤¥Æ¥à¤Î¼ïÎà¤Ë¤è¤ê¤Þ¤¹¡£", 6, 0);
4566 prt(" The prices of recharge depend on the type.", 6, 0);
4570 /* Only accept legal items */
4571 item_tester_hook = item_tester_hook_recharge;
4575 q = "¤É¤Î¥¢¥¤¥Æ¥à¤ËËâÎϤò½¼Å¶¤·¤Þ¤¹¤«? ";
4576 s = "ËâÎϤò½¼Å¶¤¹¤Ù¤¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡£";
4578 q = "Recharge which item? ";
4579 s = "You have nothing to recharge.";
4582 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
4584 /* Get the item (in the pack) */
4587 o_ptr = &inventory[item];
4590 /* Get the item (on the floor) */
4593 o_ptr = &o_list[0 - item];
4596 k_ptr = &k_info[o_ptr->k_idx];
4599 * We don't want to give the player free info about
4600 * the level of the item or the number of charges.
4602 /* The item must be "known" */
4603 if (!object_is_known(o_ptr))
4606 msg_format("½¼Å¶¤¹¤ëÁ°¤Ë´ÕÄꤵ¤ì¤Æ¤¤¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡ª");
4608 msg_format("The item must be identified first!");
4613 if ((p_ptr->au >= 50) &&
4615 get_check("¡ð50¤Ç´ÕÄꤷ¤Þ¤¹¤«¡© "))
4617 get_check("Identify for 50 gold? "))
4625 identify_item(o_ptr);
4628 object_desc(tmp_str, o_ptr, 0);
4631 msg_format("%s ¤Ç¤¹¡£", tmp_str);
4633 msg_format("You have: %s.", tmp_str);
4636 /* Auto-inscription */
4637 autopick_alter_item(item, FALSE);
4639 /* Update the gold display */
4640 building_prt_gold();
4648 /* Extract the object "level" */
4649 lev = k_info[o_ptr->k_idx].level;
4651 /* Price for a rod */
4652 if (o_ptr->tval == TV_ROD)
4654 if (o_ptr->timeout > 0)
4656 /* Fully recharge */
4657 price = (lev * 50 * o_ptr->timeout) / k_ptr->pval;
4661 /* No recharge necessary */
4664 msg_format("¤½¤ì¤ÏºÆ½¼Å¶¤¹¤ëɬÍפϤ¢¤ê¤Þ¤»¤ó¡£");
4666 msg_format("That doesn't need to be recharged.");
4672 else if (o_ptr->tval == TV_STAFF)
4674 /* Price per charge ( = double the price paid by shopkeepers for the charge) */
4675 price = (k_info[o_ptr->k_idx].cost / 10) * o_ptr->number;
4677 /* Pay at least 10 gold per charge */
4678 price = MAX(10, price);
4682 /* Price per charge ( = double the price paid by shopkeepers for the charge) */
4683 price = (k_info[o_ptr->k_idx].cost / 10);
4685 /* Pay at least 10 gold per charge */
4686 price = MAX(10, price);
4689 /* Limit the number of charges for wands and staffs */
4690 if (o_ptr->tval == TV_WAND
4691 && (o_ptr->pval / o_ptr->number >= k_ptr->pval))
4693 if (o_ptr->number > 1)
4696 msg_print("¤³¤ÎËâË¡ËÀ¤Ï¤â¤¦½¼Ê¬¤Ë½¼Å¶¤µ¤ì¤Æ¤¤¤Þ¤¹¡£");
4698 msg_print("These wands are already fully charged.");
4704 msg_print("¤³¤ÎËâË¡ËÀ¤Ï¤â¤¦½¼Ê¬¤Ë½¼Å¶¤µ¤ì¤Æ¤¤¤Þ¤¹¡£");
4706 msg_print("This wand is already fully charged.");
4711 else if (o_ptr->tval == TV_STAFF && o_ptr->pval >= k_ptr->pval)
4713 if (o_ptr->number > 1)
4716 msg_print("¤³¤Î¾ó¤Ï¤â¤¦½¼Ê¬¤Ë½¼Å¶¤µ¤ì¤Æ¤¤¤Þ¤¹¡£");
4718 msg_print("These staffs are already fully charged.");
4724 msg_print("¤³¤Î¾ó¤Ï¤â¤¦½¼Ê¬¤Ë½¼Å¶¤µ¤ì¤Æ¤¤¤Þ¤¹¡£");
4726 msg_print("This staff is already fully charged.");
4732 /* Check if the player has enough money */
4733 if (p_ptr->au < price)
4735 object_desc(tmp_str, o_ptr, OD_NAME_ONLY);
4737 msg_format("%s¤òºÆ½¼Å¶¤¹¤ë¤Ë¤Ï¡ð%d ɬÍפǤ¹¡ª", tmp_str,price );
4739 msg_format("You need %d gold to recharge %s!", price, tmp_str);
4745 if (o_ptr->tval == TV_ROD)
4748 if (get_check(format("¤½¤Î¥í¥Ã¥É¤ò¡ð%d ¤ÇºÆ½¼Å¶¤·¤Þ¤¹¤«¡©",
4751 if (get_check(format("Recharge the %s for %d gold? ",
4752 ((o_ptr->number > 1) ? "rods" : "rod"), price)))
4756 /* Recharge fully */
4766 if (o_ptr->tval == TV_STAFF)
4767 max_charges = k_ptr->pval - o_ptr->pval;
4769 max_charges = o_ptr->number * k_ptr->pval - o_ptr->pval;
4771 /* Get the quantity for staves and wands */
4773 charges = get_quantity(format("°ì²óʬ¡ð%d ¤Ç²¿²óʬ½¼Å¶¤·¤Þ¤¹¤«¡©",
4775 charges = get_quantity(format("Add how many charges for %d gold? ",
4778 price), MIN(p_ptr->au / price, max_charges));
4781 if (charges < 1) return;
4783 /* Get the new price */
4787 o_ptr->pval += charges;
4789 /* We no longer think the item is empty */
4790 o_ptr->ident &= ~(IDENT_EMPTY);
4794 object_desc(tmp_str, o_ptr, 0);
4796 msg_format("%s¤ò¡ð%d ¤ÇºÆ½¼Å¶¤·¤Þ¤·¤¿¡£", tmp_str, price);
4798 msg_format("%^s %s recharged for %d gold.", tmp_str, ((o_ptr->number > 1) ? "were" : "was"), price);
4801 /* Combine / Reorder the pack (later) */
4802 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
4805 p_ptr->window |= (PW_INVEN);
4816 * @brief ËâÆ»¶ñ¤Î»ÈÍѲó¿ô¤ò²óÉü¤µ¤»¤ë»ÜÀߤΰì³ç½èÍý¸þ¤±¥µ¥Ö¥ë¡¼¥Á¥ó / Recharge rods, wands and staves
4818 * The player can select the number of charges to add\n
4819 * (up to a limit), and the recharge never fails.\n
4821 * The cost for rods depends on the level of the rod. The prices\n
4822 * for recharging wands and staves are dependent on the cost of\n
4826 static void building_recharge_all(void)
4836 /* Display some info */
4840 prt(" ºÆ½¼Å¶¤ÎÈñÍѤϥ¢¥¤¥Æ¥à¤Î¼ïÎà¤Ë¤è¤ê¤Þ¤¹¡£", 6, 0);
4842 prt(" The prices of recharge depend on the type.", 6, 0);
4845 /* Calculate cost */
4846 for ( i = 0; i < INVEN_PACK; i++)
4848 o_ptr = &inventory[i];
4850 /* skip non magic device */
4851 if (o_ptr->tval < TV_STAFF || o_ptr->tval > TV_ROD) continue;
4853 /* need identified */
4854 if (!object_is_known(o_ptr)) total_cost += 50;
4856 /* Extract the object "level" */
4857 lev = k_info[o_ptr->k_idx].level;
4859 k_ptr = &k_info[o_ptr->k_idx];
4861 switch (o_ptr->tval)
4864 price = (lev * 50 * o_ptr->timeout) / k_ptr->pval;
4868 /* Price per charge ( = double the price paid by shopkeepers for the charge) */
4869 price = (k_info[o_ptr->k_idx].cost / 10) * o_ptr->number;
4871 /* Pay at least 10 gold per charge */
4872 price = MAX(10, price);
4875 price = (k_ptr->pval - o_ptr->pval) * price;
4879 /* Price per charge ( = double the price paid by shopkeepers for the charge) */
4880 price = (k_info[o_ptr->k_idx].cost / 10);
4882 /* Pay at least 10 gold per charge */
4883 price = MAX(10, price);
4886 price = (o_ptr->number * k_ptr->pval - o_ptr->pval) * price;
4890 /* if price <= 0 then item have enough charge */
4891 if (price > 0) total_cost += price;
4897 msg_print("½¼Å¶¤¹¤ëɬÍפϤ¢¤ê¤Þ¤»¤ó¡£");
4899 msg_print("No need to recharge.");
4906 /* Check if the player has enough money */
4907 if (p_ptr->au < total_cost)
4910 msg_format("¤¹¤Ù¤Æ¤Î¥¢¥¤¥Æ¥à¤òºÆ½¼Å¶¤¹¤ë¤Ë¤Ï¡ð%d ɬÍפǤ¹¡ª", total_cost );
4912 msg_format("You need %d gold to recharge all items!",total_cost);
4920 if (!get_check(format("¤¹¤Ù¤Æ¤Î¥¢¥¤¥Æ¥à¤ò ¡ð%d ¤ÇºÆ½¼Å¶¤·¤Þ¤¹¤«¡©", total_cost))) return;
4922 if (!get_check(format("Recharge all items for %d gold? ", total_cost))) return;
4925 for (i = 0; i < INVEN_PACK; i++)
4927 o_ptr = &inventory[i];
4928 k_ptr = &k_info[o_ptr->k_idx];
4930 /* skip non magic device */
4931 if (o_ptr->tval < TV_STAFF || o_ptr->tval > TV_ROD) continue;
4934 if (!object_is_known(o_ptr))
4936 identify_item(o_ptr);
4938 /* Auto-inscription */
4939 autopick_alter_item(i, FALSE);
4943 switch (o_ptr->tval)
4949 if (o_ptr->pval < k_ptr->pval) o_ptr->pval = k_ptr->pval;
4950 /* We no longer think the item is empty */
4951 o_ptr->ident &= ~(IDENT_EMPTY);
4954 if (o_ptr->pval < o_ptr->number * k_ptr->pval)
4955 o_ptr->pval = o_ptr->number * k_ptr->pval;
4956 /* We no longer think the item is empty */
4957 o_ptr->ident &= ~(IDENT_EMPTY);
4964 msg_format("¡ð%d ¤ÇºÆ½¼Å¶¤·¤Þ¤·¤¿¡£", total_cost);
4966 msg_format("You pay %d gold.", total_cost);
4971 /* Combine / Reorder the pack (later) */
4972 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
4975 p_ptr->window |= (PW_INVEN);
4978 p_ptr->au -= total_cost;
4985 * @brief Ä®´Ö¤Î¥Æ¥ì¥Ý¡¼¥È¤ò¹Ô¤¦¥á¥¤¥ó¥ë¡¼¥Á¥ó¡£
4986 * @return ¥Æ¥ì¥Ý¡¼¥È½èÍý¤ò·èÄꤷ¤¿¤«Èݤ«
4988 bool tele_town(void)
4996 msg_print("¤³¤ÎËâË¡¤ÏÃϾå¤Ç¤·¤«»È¤¨¤Ê¤¤¡ª");
4998 msg_print("This spell can only be used on the surface!");
5003 if (p_ptr->inside_arena || p_ptr->inside_battle)
5006 msg_print("¤³¤ÎËâË¡¤Ï³°¤Ç¤·¤«»È¤¨¤Ê¤¤¡ª");
5008 msg_print("This spell can only be used outside!");
5016 for (i=1;i<max_towns;i++)
5020 if ((i == NO_TOWN) || (i == SECRET_TOWN) || (i == p_ptr->town_num) || !(p_ptr->visit & (1L << (i-1)))) continue;
5022 sprintf(buf,"%c) %-20s", I2A(i-1), town[i].name);
5030 msg_print("¤Þ¤À¹Ô¤±¤ë¤È¤³¤í¤¬¤Ê¤¤¡£");
5032 msg_print("You have not yet visited any town.");
5041 prt("¤É¤³¤Ë¹Ô¤¤Þ¤¹¤«:", 0, 0);
5043 prt("Which town you go: ", 0, 0);
5054 else if ((i < 'a') || (i > ('a'+max_towns-2))) continue;
5055 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;
5059 for (y = 0; y < max_wild_y; y++)
5061 for (x = 0; x < max_wild_x; x++)
5063 if(wilderness[y][x].town == (i-'a'+1))
5065 p_ptr->wilderness_y = y;
5066 p_ptr->wilderness_x = x;
5071 p_ptr->leaving = TRUE;
5073 p_ptr->teleport_town = TRUE;
5079 * @brief »ÜÀߤǥâ¥ó¥¹¥¿¡¼¤Î¾ðÊó¤òÃΤë¥á¥¤¥ó¥ë¡¼¥Á¥ó / research_mon -KMW-
5080 * @return ¾ï¤ËTRUE¤òÊÖ¤¹¡£
5081 * @todo ÊÖ¤êÃͤ¬°ÕÌ£ÉÔÌÀ¤Ê¤Î¤Çľ¤·¤¿Êý¤¬Îɤ¤¤«¤â¤·¤ì¤Ê¤¤¡£
5083 static bool research_mon(void)
5091 bool recall = FALSE;
5097 /* XTRA HACK WHATSEARCH */
5103 /* XTRA HACK REMEMBER_IDX */
5104 static int old_sym = '\0';
5105 static int old_i = 0;
5108 /* Save the screen */
5111 /* Get a character, or abort */
5113 if (!get_com("¥â¥ó¥¹¥¿¡¼¤Îʸ»ú¤òÆþÎϤ·¤Æ²¼¤µ¤¤(µ¹æ or ^AÁ´,^U¥æ,^NÈó¥æ,^M̾Á°):", &sym, FALSE))
5115 if (!get_com("Enter character to be identified(^A:All,^U:Uniqs,^N:Non uniqs,^M:Name): ", &sym, FALSE))
5125 /* Find that character info, and describe it */
5126 for (i = 0; ident_info[i]; ++i)
5128 if (sym == ident_info[i][0]) break;
5131 /* XTRA HACK WHATSEARCH */
5132 if (sym == KTRL('A'))
5136 strcpy(buf, "Á´¥â¥ó¥¹¥¿¡¼¤Î¥ê¥¹¥È");
5138 strcpy(buf, "Full monster list.");
5141 else if (sym == KTRL('U'))
5145 strcpy(buf, "¥æ¥Ë¡¼¥¯¡¦¥â¥ó¥¹¥¿¡¼¤Î¥ê¥¹¥È");
5147 strcpy(buf, "Unique monster list.");
5150 else if (sym == KTRL('N'))
5154 strcpy(buf, "¥æ¥Ë¡¼¥¯³°¥â¥ó¥¹¥¿¡¼¤Î¥ê¥¹¥È");
5156 strcpy(buf, "Non-unique monster list.");
5159 else if (sym == KTRL('M'))
5163 if (!get_string("̾Á°(±Ñ¸ì¤Î¾ì¹ç¾®Ê¸»ú¤Ç²Ä)",temp, 70))
5165 if (!get_string("Enter name:",temp, 70))
5176 sprintf(buf, "̾Á°:%s¤Ë¥Þ¥Ã¥Á",temp);
5178 sprintf(buf, "Monsters with a name \"%s\"",temp);
5181 else if (ident_info[i])
5183 sprintf(buf, "%c - %s.", sym, ident_info[i] + 2);
5188 sprintf(buf, "%c - %s", sym, "̵¸ú¤Êʸ»ú");
5190 sprintf(buf, "%c - %s.", sym, "Unknown Symbol");
5195 /* Display the result */
5199 /* Allocate the "who" array */
5200 C_MAKE(who, max_r_idx, u16b);
5202 /* Collect matching monsters */
5203 for (n = 0, i = 1; i < max_r_idx; i++)
5205 monster_race *r_ptr = &r_info[i];
5208 if (!r_ptr->name) continue;
5210 /* XTRA HACK WHATSEARCH */
5211 /* Require non-unique monsters if needed */
5212 if (norm && (r_ptr->flags1 & (RF1_UNIQUE))) continue;
5214 /* Require unique monsters if needed */
5215 if (uniq && !(r_ptr->flags1 & (RF1_UNIQUE))) continue;
5223 for (xx = 0; temp[xx] && xx < 80; xx++)
5226 if (iskanji(temp[xx]))
5232 if (isupper(temp[xx])) temp[xx] = tolower(temp[xx]);
5236 strcpy(temp2, r_name + r_ptr->E_name);
5238 strcpy(temp2, r_name + r_ptr->name);
5240 for (xx = 0; temp2[xx] && xx < 80; xx++)
5241 if (isupper(temp2[xx])) temp2[xx] = tolower(temp2[xx]);
5244 if (my_strstr(temp2, temp) || my_strstr(r_name + r_ptr->name, temp))
5246 if (my_strstr(temp2, temp))
5250 else if (all || (r_ptr->d_char == sym)) who[n++] = i;
5253 /* Nothing to recall */
5256 /* Free the "who" array */
5257 C_KILL(who, max_r_idx, u16b);
5269 /* Sort if needed */
5272 /* Select the sort method */
5273 ang_sort_comp = ang_sort_comp_hook;
5274 ang_sort_swap = ang_sort_swap_hook;
5276 /* Sort the array */
5277 ang_sort(who, &why, n);
5281 /* Start at the end */
5282 /* XTRA HACK REMEMBER_IDX */
5283 if (old_sym == sym && old_i < n) i = old_i;
5288 /* Scan the monster memory */
5291 /* Extract a race */
5294 /* Hack -- Begin the prompt */
5297 /* Hack -- Complete the prompt */
5299 Term_addstr(-1, TERM_WHITE, " ['r'»×¤¤½Ð, ' '¤Ç³¹Ô, ESC]");
5301 Term_addstr(-1, TERM_WHITE, " [(r)ecall, ESC, space to continue]");
5311 /*** Recall on screen ***/
5313 /* Get maximal info about this monster */
5314 lore_do_probe(r_idx);
5316 /* Save this monster ID */
5317 monster_race_track(r_idx);
5319 /* Hack -- Handle stuff */
5322 /* know every thing mode */
5323 screen_roff(r_idx, 0x01);
5326 /* XTRA HACK REMEMBER_IDX */
5334 /* Normal commands */
5335 if (query != 'r') break;
5342 if (query == ESCAPE) break;
5344 /* Move to "prev" monster */
5350 if (!expand_list) break;
5354 /* Move to "next" monster */
5360 if (!expand_list) break;
5366 /* Re-display the identity */
5367 /* prt(buf, 5, 5);*/
5369 /* Free the "who" array */
5370 C_KILL(who, max_r_idx, u16b);
5375 return (!notpicked);
5380 * @brief »ÜÀߤνèÍý¼Â¹Ô¥á¥¤¥ó¥ë¡¼¥Á¥ó / Execute a building command
5381 * @param bldg »ÜÀß¹½Â¤ÂΤλ²¾È¥Ý¥¤¥ó¥¿
5382 * @param i ¼Â¹Ô¤·¤¿¤¤»ÜÀߤΥµ¡¼¥Ó¥¹¥Æ¡¼¥Ö¥ë¤Îź»ú
5385 static void bldg_process_command(building_type *bldg, int i)
5387 int bact = bldg->actions[i];
5392 /* Flush messages XXX XXX XXX */
5397 bcost = bldg->member_costs[i];
5399 bcost = bldg->other_costs[i];
5401 /* action restrictions */
5402 if (((bldg->action_restr[i] == 1) && !is_member(bldg)) ||
5403 ((bldg->action_restr[i] == 2) && !is_owner(bldg)))
5406 msg_print("¤½¤ì¤òÁªÂò¤¹¤ë¸¢Íø¤Ï¤¢¤ê¤Þ¤»¤ó¡ª");
5408 msg_print("You have no right to choose that!");
5413 /* check gold (HACK - Recharge uses variable costs) */
5414 if ((bact != BACT_RECHARGE) &&
5415 (((bldg->member_costs[i] > p_ptr->au) && is_owner(bldg)) ||
5416 ((bldg->other_costs[i] > p_ptr->au) && !is_owner(bldg))))
5419 msg_print("¤ª¶â¤¬Â¤ê¤Þ¤»¤ó¡ª");
5421 msg_print("You do not have the gold!");
5431 case BACT_RESEARCH_ITEM:
5432 paid = identify_fully(FALSE);
5434 case BACT_TOWN_HISTORY:
5437 case BACT_RACE_LEGENDS:
5443 case BACT_KING_LEGENDS:
5444 case BACT_ARENA_LEGENDS:
5449 case BACT_ARENA_RULES:
5453 case BACT_IN_BETWEEN:
5455 case BACT_SPIN_WHEEL:
5456 case BACT_DICE_SLOTS:
5457 case BACT_GAMBLE_RULES:
5464 paid = inn_comm(bact);
5466 case BACT_RESEARCH_MONSTER:
5467 paid = research_mon();
5469 case BACT_COMPARE_WEAPONS:
5471 bcost = compare_weapons(bcost);
5473 case BACT_ENCHANT_WEAPON:
5474 item_tester_hook = object_allow_enchant_melee_weapon;
5475 enchant_item(bcost, 1, 1, 0);
5477 case BACT_ENCHANT_ARMOR:
5478 item_tester_hook = object_is_armour;
5479 enchant_item(bcost, 0, 0, 1);
5482 building_recharge();
5484 case BACT_RECHARGE_ALL:
5485 building_recharge_all();
5487 case BACT_IDENTS: /* needs work */
5489 if (!get_check("»ý¤Áʪ¤òÁ´¤Æ´ÕÄꤷ¤Æ¤è¤í¤·¤¤¤Ç¤¹¤«¡©")) break;
5491 msg_print(" »ý¤ÁʪÁ´¤Æ¤¬´ÕÄꤵ¤ì¤Þ¤·¤¿¡£");
5493 if (!get_check("Do you pay for identify all your possession? ")) break;
5495 msg_print("Your possessions have been identified.");
5500 case BACT_IDENT_ONE: /* needs work */
5501 paid = ident_spell(FALSE);
5506 case BACT_HEALING: /* needs work */
5515 case BACT_RESTORE: /* needs work */
5516 if (do_res_stat(A_STR)) paid = TRUE;
5517 if (do_res_stat(A_INT)) paid = TRUE;
5518 if (do_res_stat(A_WIS)) paid = TRUE;
5519 if (do_res_stat(A_DEX)) paid = TRUE;
5520 if (do_res_stat(A_CON)) paid = TRUE;
5521 if (do_res_stat(A_CHR)) paid = TRUE;
5523 case BACT_ENCHANT_ARROWS:
5524 item_tester_hook = item_tester_hook_ammo;
5525 enchant_item(bcost, 1, 1, 0);
5527 case BACT_ENCHANT_BOW:
5528 item_tester_tval = TV_BOW;
5529 enchant_item(bcost, 1, 1, 0);
5532 if (recall_player(1)) paid = TRUE;
5534 case BACT_TELEPORT_LEVEL:
5541 select_dungeon = choose_dungeon("¤Ë¥Æ¥ì¥Ý¡¼¥È", 4, 0);
5543 select_dungeon = choose_dungeon("teleport", 4, 0);
5545 show_building(bldg);
5546 if (!select_dungeon) return;
5548 max_depth = d_info[select_dungeon].maxdepth;
5550 /* Limit depth in Angband */
5551 if (select_dungeon == DUNGEON_ANGBAND)
5553 if (quest[QUEST_OBERON].status != QUEST_STATUS_FINISHED) max_depth = 98;
5554 else if(quest[QUEST_SERPENT].status != QUEST_STATUS_FINISHED) max_depth = 99;
5558 amt = get_quantity(format("%s¤Î²¿³¬¤Ë¥Æ¥ì¥Ý¡¼¥È¤·¤Þ¤¹¤«¡©", d_name + d_info[select_dungeon].name), max_depth);
5560 amt = get_quantity(format("Teleport to which level of %s? ", d_name + d_info[select_dungeon].name), max_depth);
5565 p_ptr->word_recall = 1;
5566 p_ptr->recall_dungeon = select_dungeon;
5567 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));
5568 if (record_maxdepth)
5570 do_cmd_write_nikki(NIKKI_TRUMP, select_dungeon, "¥È¥é¥ó¥×¥¿¥ï¡¼¤Ç");
5572 do_cmd_write_nikki(NIKKI_TRUMP, select_dungeon, "at Trump Tower");
5575 msg_print("²ó¤ê¤ÎÂ絤¤¬Ä¥¤ê¤Ä¤á¤Æ¤¤¿...");
5577 msg_print("The air about you becomes charged...");
5581 p_ptr->redraw |= (PR_STATUS);
5585 case BACT_LOSE_MUTATION:
5586 if (p_ptr->muta1 || p_ptr->muta2 ||
5587 (p_ptr->muta3 & ~MUT3_GOOD_LUCK) ||
5588 (p_ptr->pseikaku != SEIKAKU_LUCKY &&
5589 (p_ptr->muta3 & MUT3_GOOD_LUCK)))
5591 while(!lose_mutation(0));
5597 msg_print("¼£¤¹¤Ù¤ÆÍÁ³ÊÑ°Û¤¬Ìµ¤¤¡£");
5599 msg_print("You have no mutations.");
5607 case BACT_TSUCHINOKO:
5621 msg_print("Ê¿¹Õ²½¤Îµ·¼°¤ò¹Ô¤Ê¤Ã¤¿¡£");
5623 msg_print("You received an equalization ritual.");
5625 set_virtue(V_COMPASSION, 0);
5626 set_virtue(V_HONOUR, 0);
5627 set_virtue(V_JUSTICE, 0);
5628 set_virtue(V_SACRIFICE, 0);
5629 set_virtue(V_KNOWLEDGE, 0);
5630 set_virtue(V_FAITH, 0);
5631 set_virtue(V_ENLIGHTEN, 0);
5632 set_virtue(V_ENCHANT, 0);
5633 set_virtue(V_CHANCE, 0);
5634 set_virtue(V_NATURE, 0);
5635 set_virtue(V_HARMONY, 0);
5636 set_virtue(V_VITALITY, 0);
5637 set_virtue(V_UNLIFE, 0);
5638 set_virtue(V_PATIENCE, 0);
5639 set_virtue(V_TEMPERANCE, 0);
5640 set_virtue(V_DILIGENCE, 0);
5641 set_virtue(V_VALOUR, 0);
5642 set_virtue(V_INDIVIDUALISM, 0);
5646 case BACT_TELE_TOWN:
5650 paid = eval_ac(p_ptr->dis_ac + p_ptr->dis_to_a);
5652 case BACT_BROKEN_WEAPON:
5654 bcost = repair_broken_weapon(bcost);
5665 * @brief ¥¯¥¨¥¹¥ÈÆþ¤ê¸ý¤Ë¥×¥ì¥¤¥ä¡¼¤¬¾è¤Ã¤¿ºÝ¤Î½èÍý / Do building commands
5668 void do_cmd_quest(void)
5672 if (!cave_have_flag_bold(py, px, FF_QUEST_ENTER))
5675 msg_print("¤³¤³¤Ë¤Ï¥¯¥¨¥¹¥È¤ÎÆþ¸ý¤Ï¤Ê¤¤¡£");
5677 msg_print("You see no quest level here.");
5685 msg_print("¤³¤³¤Ë¤Ï¥¯¥¨¥¹¥È¤Ø¤ÎÆþ¸ý¤¬¤¢¤ê¤Þ¤¹¡£");
5686 if (!get_check("¥¯¥¨¥¹¥È¤ËÆþ¤ê¤Þ¤¹¤«¡©")) return;
5687 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
5688 msg_print("¡Ø¤È¤Ë¤«¤¯Æþ¤Ã¤Æ¤ß¤è¤¦¤¼¤§¡£¡Ù");
5690 msg_print("There is an entry of a quest.");
5691 if (!get_check("Do you enter? ")) return;
5694 /* Player enters a new quest */
5698 leave_quest_check();
5700 if (quest[p_ptr->inside_quest].type != QUEST_TYPE_RANDOM) dun_level = 1;
5701 p_ptr->inside_quest = cave[py][px].special;
5703 p_ptr->leaving = TRUE;
5709 * @brief »ÜÀßÆþ¤ê¸ý¤Ë¥×¥ì¥¤¥ä¡¼¤¬¾è¤Ã¤¿ºÝ¤Î½èÍý / Do building commands
5712 void do_cmd_bldg(void)
5717 building_type *bldg;
5722 if (!cave_have_flag_bold(py, px, FF_BLDG))
5725 msg_print("¤³¤³¤Ë¤Ï·úʪ¤Ï¤Ê¤¤¡£");
5727 msg_print("You see no building here.");
5733 which = f_info[cave[py][px].feat].subtype;
5735 bldg = &building[which];
5737 /* Don't re-init the wilderness */
5738 reinit_wilderness = FALSE;
5740 if ((which == 2) && (p_ptr->arena_number < 0))
5743 msg_print("¡ÖÇÔ¼Ô¤ËÍѤϤʤ¤¡£¡×");
5745 msg_print("'There's no place here for a LOSER like you!'");
5749 else if ((which == 2) && p_ptr->inside_arena)
5751 if (!p_ptr->exit_bldg && m_cnt > 0)
5754 prt("¥²¡¼¥È¤ÏÊĤޤäƤ¤¤ë¡£¥â¥ó¥¹¥¿¡¼¤¬¤¢¤Ê¤¿¤òÂԤäƤ¤¤ë¡ª", 0, 0);
5756 prt("The gates are closed. The monster awaits!", 0, 0);
5761 /* Don't save the arena as saved floor */
5762 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_NO_RETURN);
5764 p_ptr->inside_arena = FALSE;
5765 p_ptr->leaving = TRUE;
5767 /* Re-enter the arena */
5768 command_new = SPECIAL_KEY_BUILDING;
5770 /* No energy needed to re-enter the arena */
5776 else if (p_ptr->inside_battle)
5778 /* Don't save the arena as saved floor */
5779 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_NO_RETURN);
5781 p_ptr->leaving = TRUE;
5782 p_ptr->inside_battle = FALSE;
5784 /* Re-enter the monster arena */
5785 command_new = SPECIAL_KEY_BUILDING;
5787 /* No energy needed to re-enter the arena */
5798 /* Forget the lite */
5801 /* Forget the view */
5804 /* Hack -- Increase "icky" depth */
5811 show_building(bldg);
5819 building_prt_gold();
5823 if (command == ESCAPE)
5826 p_ptr->inside_arena = FALSE;
5827 p_ptr->inside_battle = FALSE;
5831 for (i = 0; i < 8; i++)
5833 if (bldg->letters[i])
5835 if (bldg->letters[i] == command)
5844 bldg_process_command(bldg, i);
5853 /* Flush messages XXX XXX XXX */
5857 /* Reinit wilderness to activate quests ... */
5858 if (reinit_wilderness)
5860 p_ptr->leaving = TRUE;
5863 /* Hack -- Decrease "icky" depth */
5866 /* Clear the screen */
5869 /* Update the visuals */
5870 p_ptr->update |= (PU_VIEW | PU_MONSTERS | PU_BONUS | PU_LITE | PU_MON_LITE);
5872 /* Redraw entire screen */
5873 p_ptr->redraw |= (PR_BASIC | PR_EXTRA | PR_EQUIPPY | PR_MAP);
5876 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
5881 * @brief ¥¯¥¨¥¹¥ÈÆÍÆþ»þ¤Î¥á¥Ã¥»¡¼¥¸¥Æ¡¼¥Ö¥ë / Array of places to find an inscription
5883 static cptr find_quest[] =
5886 "¾²¤Ë¥á¥Ã¥»¡¼¥¸¤¬¹ï¤Þ¤ì¤Æ¤¤¤ë:",
5888 "You find the following inscription in the floor",
5892 "Êɤ˥á¥Ã¥»¡¼¥¸¤¬¹ï¤Þ¤ì¤Æ¤¤¤ë:",
5894 "You see a message inscribed in the wall",
5898 "¥á¥Ã¥»¡¼¥¸¤ò¸«¤Ä¤±¤¿:",
5900 "There is a sign saying",
5904 "²¿¤«¤¬³¬Ãʤξå¤Ë½ñ¤¤¤Æ¤¢¤ë:",
5906 "Something is written on the staircase",
5910 "´¬Êª¤ò¸«¤Ä¤±¤¿¡£¥á¥Ã¥»¡¼¥¸¤¬½ñ¤¤¤Æ¤¢¤ë:",
5912 "You find a scroll with the following message",
5919 * @brief ¥¯¥¨¥¹¥È¤ÎƳÆþ¥á¥Ã¥»¡¼¥¸¤òɽ¼¨¤¹¤ë / Discover quest
5920 * @param q_idx ³«»Ï¤µ¤ì¤¿¥¯¥¨¥¹¥È¤ÎID
5922 void quest_discovery(int q_idx)
5924 quest_type *q_ptr = &quest[q_idx];
5925 monster_race *r_ptr = &r_info[q_ptr->r_idx];
5926 int q_num = q_ptr->max_num;
5929 /* No quest index */
5932 strcpy(name, (r_name + r_ptr->name));
5934 msg_print(find_quest[rand_range(0, 4)]);
5941 /* Hack -- "unique" monsters must be "unique" */
5942 if ((r_ptr->flags1 & RF1_UNIQUE) &&
5943 (0 == r_ptr->max_num))
5946 msg_print("¤³¤Î³¬¤Ï°ÊÁ°¤Ï狼¤Ë¤è¤Ã¤Æ¼é¤é¤ì¤Æ¤¤¤¿¤è¤¦¤À¡Ä¡£");
5948 msg_print("It seems that this level was protected by someone before...");
5950 /* The unique is already dead */
5951 quest[q_idx].status = QUEST_STATUS_FINISHED;
5954 q_ptr->comptime = playtime;
5959 msg_format("Ãí°Õ¤»¤è¡ª¤³¤Î³¬¤Ï%s¤Ë¤è¤Ã¤Æ¼é¤é¤ì¤Æ¤¤¤ë¡ª", name);
5961 msg_format("Beware, this level is protected by %s!", name);
5967 /* Normal monsters */
5969 msg_format("Ãí°Õ¤·¤í¡ª¤³¤Î³¬¤Ï%dÂΤÎ%s¤Ë¤è¤Ã¤Æ¼é¤é¤ì¤Æ¤¤¤ë¡ª", q_num, name);
5972 msg_format("Be warned, this level is guarded by %d %s!", q_num, name);
5980 * @brief ¿·¤·¤¯Æþ¤Ã¤¿¥À¥ó¥¸¥ç¥ó¤Î³¬Áؤ˸ÇÄꤵ¤ì¤Æ¤¤¤ë°ìÈ̤Υ¯¥¨¥¹¥È¤òõ¤·½Ð¤·ID¤òÊÖ¤¹¡£
5981 * / Hack -- Check if a level is a "quest" level
5982 * @param level ¸¡º÷Âоݤˤʤ볬
5983 * @return ¥¯¥¨¥¹¥ÈID¤òÊÖ¤¹¡£³ºÅö¤¬¤Ê¤¤¾ì¹ç0¤òÊÖ¤¹¡£
5985 int quest_number(int level)
5990 if (p_ptr->inside_quest)
5991 return (p_ptr->inside_quest);
5993 for (i = 0; i < max_quests; i++)
5995 if (quest[i].status != QUEST_STATUS_TAKEN) continue;
5997 if ((quest[i].type == QUEST_TYPE_KILL_LEVEL) &&
5998 !(quest[i].flags & QUEST_FLAG_PRESET) &&
5999 (quest[i].level == level) &&
6000 (quest[i].dungeon == dungeon_type))
6004 /* Check for random quest */
6005 return (random_quest_number(level));
6009 * @brief ¿·¤·¤¯Æþ¤Ã¤¿¥À¥ó¥¸¥ç¥ó¤Î³¬Áؤ˸ÇÄꤵ¤ì¤Æ¤¤¤ë¥é¥ó¥À¥à¥¯¥¨¥¹¥È¤òõ¤·½Ð¤·ID¤òÊÖ¤¹¡£
6010 * @param level ¸¡º÷Âоݤˤʤ볬
6011 * @return ¥¯¥¨¥¹¥ÈID¤òÊÖ¤¹¡£³ºÅö¤¬¤Ê¤¤¾ì¹ç0¤òÊÖ¤¹¡£
6013 int random_quest_number(int level)
6017 if (dungeon_type != DUNGEON_ANGBAND) return 0;
6019 for (i = MIN_RANDOM_QUEST; i < MAX_RANDOM_QUEST + 1; i++)
6021 if ((quest[i].type == QUEST_TYPE_RANDOM) &&
6022 (quest[i].status == QUEST_STATUS_TAKEN) &&
6023 (quest[i].level == level) &&
6024 (quest[i].dungeon == DUNGEON_ANGBAND))