3 * @brief »¨Â¿¤Ê¤½¤Î¾¤Î½èÍý2 / effects of various "objects"
6 * Copyright (c) 1989 James E. Wilson, Robert A. Koeneke\n
7 * This software may be copied and distributed for educational, research, and\n
8 * not for profit purposes provided that this copyright and statement are\n
9 * included in all such copies.\n
10 * 2014 Deskull rearranged comment for Doxygen.
16 #define REWARD_CHANCE 10
20 * @brief ¥×¥ì¥¤¥ä¡¼¤Î·Ð¸³ÃͤˤĤ¤¤ÆÀ°¹çÀ¤Î¤¿¤á¤Î¥Á¥§¥Ã¥¯¤ÈÄ´À°¤ò¹Ô¤¦ /
21 * Advance experience levels and print experience
24 void check_experience(void)
26 bool level_reward = FALSE;
27 bool level_mutation = FALSE;
28 bool level_inc_stat = FALSE;
29 bool android = (p_ptr->prace == RACE_ANDROID ? TRUE : FALSE);
30 int old_lev = p_ptr->lev;
32 /* Hack -- lower limit */
33 if (p_ptr->exp < 0) p_ptr->exp = 0;
34 if (p_ptr->max_exp < 0) p_ptr->max_exp = 0;
35 if (p_ptr->max_max_exp < 0) p_ptr->max_max_exp = 0;
37 /* Hack -- upper limit */
38 if (p_ptr->exp > PY_MAX_EXP) p_ptr->exp = PY_MAX_EXP;
39 if (p_ptr->max_exp > PY_MAX_EXP) p_ptr->max_exp = PY_MAX_EXP;
40 if (p_ptr->max_max_exp > PY_MAX_EXP) p_ptr->max_max_exp = PY_MAX_EXP;
42 /* Hack -- maintain "max" experience */
43 if (p_ptr->exp > p_ptr->max_exp) p_ptr->max_exp = p_ptr->exp;
45 /* Hack -- maintain "max max" experience */
46 if (p_ptr->max_exp > p_ptr->max_max_exp) p_ptr->max_max_exp = p_ptr->max_exp;
48 /* Redraw experience */
49 p_ptr->redraw |= (PR_EXP);
55 /* Lose levels while possible */
56 while ((p_ptr->lev > 1) &&
57 (p_ptr->exp < ((android ? player_exp_a : player_exp)[p_ptr->lev - 2] * p_ptr->expfact / 100L)))
62 /* Update some stuff */
63 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
65 /* Redraw some stuff */
66 p_ptr->redraw |= (PR_LEV | PR_TITLE);
69 p_ptr->window |= (PW_PLAYER);
76 /* Gain levels while possible */
77 while ((p_ptr->lev < PY_MAX_LEVEL) &&
78 (p_ptr->exp >= ((android ? player_exp_a : player_exp)[p_ptr->lev-1] * p_ptr->expfact / 100L)))
83 /* Save the highest level */
84 if (p_ptr->lev > p_ptr->max_plv)
86 p_ptr->max_plv = p_ptr->lev;
88 if ((p_ptr->pclass == CLASS_CHAOS_WARRIOR) ||
89 (p_ptr->muta2 & MUT2_CHAOS_GIFT))
93 if (p_ptr->prace == RACE_BEASTMAN)
95 if (one_in_(5)) level_mutation = TRUE;
97 level_inc_stat = TRUE;
99 do_cmd_write_nikki(NIKKI_LEVELUP, p_ptr->lev, NULL);
107 msg_format("¥ì¥Ù¥ë %d ¤Ë¤è¤¦¤³¤½¡£", p_ptr->lev);
109 msg_format("Welcome to level %d.", p_ptr->lev);
113 /* Update some stuff */
114 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
116 /* Redraw some stuff */
117 p_ptr->redraw |= (PR_LEV | PR_TITLE | PR_EXP);
120 p_ptr->window |= (PW_PLAYER | PW_SPELL | PW_INVEN);
122 /* HP¤ÈMP¤Î¾å¾ºÎ̤òɽ¼¨ */
132 if(!(p_ptr->max_plv % 10))
142 cnv_stat(p_ptr->stat_max[0], tmp);
143 prt(format(" a) ÏÓÎÏ (¸½ºßÃÍ %s)", tmp), 2, 14);
144 cnv_stat(p_ptr->stat_max[1], tmp);
145 prt(format(" b) ÃÎǽ (¸½ºßÃÍ %s)", tmp), 3, 14);
146 cnv_stat(p_ptr->stat_max[2], tmp);
147 prt(format(" c) ¸¤µ (¸½ºßÃÍ %s)", tmp), 4, 14);
148 cnv_stat(p_ptr->stat_max[3], tmp);
149 prt(format(" d) ´ïÍÑ (¸½ºßÃÍ %s)", tmp), 5, 14);
150 cnv_stat(p_ptr->stat_max[4], tmp);
151 prt(format(" e) ÂÑµ× (¸½ºßÃÍ %s)", tmp), 6, 14);
152 cnv_stat(p_ptr->stat_max[5], tmp);
153 prt(format(" f) Ì¥ÎÏ (¸½ºßÃÍ %s)", tmp), 7, 14);
155 prt(" ¤É¤ÎǽÎÏÃͤò¾å¤²¤Þ¤¹¤«¡©", 1, 14);
157 cnv_stat(p_ptr->stat_max[0], tmp);
158 prt(format(" a) Str (cur %s)", tmp), 2, 14);
159 cnv_stat(p_ptr->stat_max[1], tmp);
160 prt(format(" b) Int (cur %s)", tmp), 3, 14);
161 cnv_stat(p_ptr->stat_max[2], tmp);
162 prt(format(" c) Wis (cur %s)", tmp), 4, 14);
163 cnv_stat(p_ptr->stat_max[3], tmp);
164 prt(format(" d) Dex (cur %s)", tmp), 5, 14);
165 cnv_stat(p_ptr->stat_max[4], tmp);
166 prt(format(" e) Con (cur %s)", tmp), 6, 14);
167 cnv_stat(p_ptr->stat_max[5], tmp);
168 prt(format(" f) Chr (cur %s)", tmp), 7, 14);
170 prt(" Which stat do you want to raise?", 1, 14);
175 if ((choice >= 'a') && (choice <= 'f')) break;
177 for(n = 0; n < 6; n++)
178 if (n != choice - 'a')
181 if (get_check("¤è¤í¤·¤¤¤Ç¤¹¤«¡©")) break;
183 if (get_check("Are you sure? ")) break;
186 do_inc_stat(choice - 'a');
189 else if(!(p_ptr->max_plv % 2))
190 do_inc_stat(randint0(6));
196 msg_print("¤¢¤Ê¤¿¤ÏÊѤï¤Ã¤¿µ¤¤¬¤¹¤ë...");
198 msg_print("You feel different...");
201 (void)gain_random_mutation(0);
202 level_mutation = FALSE;
206 * Ê󽷤ǥì¥Ù¥ë¤¬¾å¤ë¤ÈºÆµ¢Åª¤Ë check_experience() ¤¬
207 * ¸Æ¤Ð¤ì¤ë¤Î¤Ç½çÈÖ¤òºÇ¸å¤Ë¤¹¤ë¡£
211 gain_level_reward(0);
212 level_reward = FALSE;
215 /* Update some stuff */
216 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
218 /* Redraw some stuff */
219 p_ptr->redraw |= (PR_LEV | PR_TITLE);
222 p_ptr->window |= (PW_PLAYER | PW_SPELL);
228 /* Load an autopick preference file */
229 if (old_lev != p_ptr->lev) autopick_load_pref(FALSE);
234 * @brief ¥â¥ó¥¹¥¿¡¼¤òÅݤ·¤¿ºÝ¤ÎºâÊõsval¤òÊÖ¤¹
235 * @param r_idx Åݤ·¤¿¥â¥ó¥¹¥¿¡¼¤Î¼ï²ID
238 * Hack -- Return the "automatic coin type" of a monster race
239 * Used to allocate proper treasure when "Creeping coins" die
240 * XXX XXX XXX Note the use of actual "monster names"
242 static int get_coin_type(int r_idx)
244 /* Analyze monsters */
247 case MON_COPPER_COINS: return 2;
248 case MON_SILVER_COINS: return 5;
249 case MON_GOLD_COINS: return 10;
250 case MON_MITHRIL_COINS:
251 case MON_MITHRIL_GOLEM: return 16;
252 case MON_ADAMANT_COINS: return 17;
261 * @brief ¥ª¥Ö¥¸¥§¥¯¥È¤¬¥¯¥í¡¼¥¯¤«¤É¤¦¤«¤òȽÄꤹ¤ë /
262 * Hack -- determine if a template is Cloak
263 * @param k_idx ȽÄꤷ¤¿¤¤¥ª¥Ö¥¸¥§¥¯¥È¤Î¥Ù¡¼¥¹¥¢¥¤¥Æ¥àID
264 * @return ¥ª¥Ö¥¸¥§¥¯¥È¤¬¥¯¥í¡¼¥¯¤Ê¤é¤ÐTRUE¤òÊÖ¤¹
266 static bool kind_is_cloak(int k_idx)
268 object_kind *k_ptr = &k_info[k_idx];
270 /* Analyze the item type */
271 if (k_ptr->tval == TV_CLOAK)
276 /* Assume not good */
282 * @brief ¥ª¥Ö¥¸¥§¥¯¥È¤¬´È¾õÉð´ï¤«¤É¤¦¤«¤òȽÄꤹ¤ë /
283 * Hack -- determine if a template is Polearm
284 * @param k_idx ȽÄꤷ¤¿¤¤¥ª¥Ö¥¸¥§¥¯¥È¤Î¥Ù¡¼¥¹¥¢¥¤¥Æ¥àID
285 * @return ¥ª¥Ö¥¸¥§¥¯¥È¤¬´È¾õÉð´ï¤Ê¤é¤ÐTRUE¤òÊÖ¤¹
287 static bool kind_is_polearm(int k_idx)
289 object_kind *k_ptr = &k_info[k_idx];
291 /* Analyze the item type */
292 if (k_ptr->tval == TV_POLEARM)
297 /* Assume not good */
303 * @brief ¥ª¥Ö¥¸¥§¥¯¥È¤¬·õ¤«¤É¤¦¤«¤òȽÄꤹ¤ë /
304 * Hack -- determine if a template is Sword
305 * @param k_idx ȽÄꤷ¤¿¤¤¥ª¥Ö¥¸¥§¥¯¥È¤Î¥Ù¡¼¥¹¥¢¥¤¥Æ¥àID
306 * @return ¥ª¥Ö¥¸¥§¥¯¥È¤¬·õ¤Ê¤é¤ÐTRUE¤òÊÖ¤¹
308 static bool kind_is_sword(int k_idx)
310 object_kind *k_ptr = &k_info[k_idx];
312 /* Analyze the item type */
313 if ((k_ptr->tval == TV_SWORD) && (k_ptr->sval > 2))
318 /* Assume not good */
324 * @brief ¥ª¥Ö¥¸¥§¥¯¥È¤¬ËâË¡½ñ¤«¤É¤¦¤«¤òȽÄꤹ¤ë /
325 * Hack -- determine if a template is Book
326 * @param k_idx ȽÄꤷ¤¿¤¤¥ª¥Ö¥¸¥§¥¯¥È¤Î¥Ù¡¼¥¹¥¢¥¤¥Æ¥àID
327 * @return ¥ª¥Ö¥¸¥§¥¯¥È¤¬ËâË¡½ñ¤Ê¤é¤ÐTRUE¤òÊÖ¤¹
329 static bool kind_is_book(int k_idx)
331 object_kind *k_ptr = &k_info[k_idx];
333 /* Analyze the item type */
334 if ((k_ptr->tval >= TV_LIFE_BOOK) && (k_ptr->tval <= TV_CRUSADE_BOOK))
339 /* Assume not good */
345 * @brief ¥ª¥Ö¥¸¥§¥¯¥È¤¬¥Ù¡¼¥¹¥¢¥¤¥Æ¥à»þÅÀ¤ÇGOOD¤«¤É¤¦¤«¤òȽÄꤹ¤ë /
346 * Hack -- determine if a template is Good book
347 * @param k_idx ȽÄꤷ¤¿¤¤¥ª¥Ö¥¸¥§¥¯¥È¤Î¥Ù¡¼¥¹¥¢¥¤¥Æ¥àID
348 * @return ¥ª¥Ö¥¸¥§¥¯¥È¤¬¥Ù¡¼¥¹¥¢¥¤¥Æ¥à»þÅÀ¤ÇGOOD¤Ê¥¢¥¤¥Æ¥à¤Ê¤é¤ÐTRUE¤òÊÖ¤¹
350 static bool kind_is_good_book(int k_idx)
352 object_kind *k_ptr = &k_info[k_idx];
354 /* Analyze the item type */
355 if ((k_ptr->tval >= TV_LIFE_BOOK) && (k_ptr->tval <= TV_CRUSADE_BOOK) && (k_ptr->tval != TV_ARCANE_BOOK) && (k_ptr->sval > 1))
360 /* Assume not good */
366 * @brief ¥ª¥Ö¥¸¥§¥¯¥È¤¬³»¤«¤É¤¦¤«¤òȽÄꤹ¤ë /
367 * Hack -- determine if a template is Armor
368 * @param k_idx ȽÄꤷ¤¿¤¤¥ª¥Ö¥¸¥§¥¯¥È¤Î¥Ù¡¼¥¹¥¢¥¤¥Æ¥àID
369 * @return ¥ª¥Ö¥¸¥§¥¯¥È¤¬³»¤Ê¤é¤ÐTRUE¤òÊÖ¤¹
371 static bool kind_is_armor(int k_idx)
373 object_kind *k_ptr = &k_info[k_idx];
375 /* Analyze the item type */
376 if (k_ptr->tval == TV_HARD_ARMOR)
381 /* Assume not good */
387 * @brief ¥ª¥Ö¥¸¥§¥¯¥È¤¬ÂÇ·âÉð´ï¤«¤É¤¦¤«¤òȽÄꤹ¤ë /
388 * Hack -- determine if a template is hafted weapon
389 * @param k_idx ȽÄꤷ¤¿¤¤¥ª¥Ö¥¸¥§¥¯¥È¤Î¥Ù¡¼¥¹¥¢¥¤¥Æ¥àID
390 * @return ¥ª¥Ö¥¸¥§¥¯¥È¤¬ÂÇ·âÉð´ï¤Ê¤é¤ÐTRUE¤òÊÖ¤¹
392 static bool kind_is_hafted(int k_idx)
394 object_kind *k_ptr = &k_info[k_idx];
396 /* Analyze the item type */
397 if (k_ptr->tval == TV_HAFTED)
402 /* Assume not good */
407 * @brief ¥¯¥¨¥¹¥È¤òãÀ®¾õÂ֤ˤ¹¤ë /
408 * @param quest_num ãÀ®¾õÂ֤ˤ·¤¿¤¤¥¯¥¨¥¹¥È¤ÎID
411 void complete_quest(int quest_num)
413 quest_type* const q_ptr = &quest[quest_num];
417 case QUEST_TYPE_RANDOM:
418 if (record_rand_quest) do_cmd_write_nikki(NIKKI_RAND_QUEST_C, quest_num, NULL);
421 if (record_fix_quest) do_cmd_write_nikki(NIKKI_FIX_QUEST_C, quest_num, NULL);
425 q_ptr->status = QUEST_STATUS_COMPLETED;
426 q_ptr->complev = (byte)p_ptr->lev;
428 q_ptr->comptime = playtime;
430 if (!(q_ptr->flags & QUEST_FLAG_SILENT))
432 msg_print(_("¥¯¥¨¥¹¥È¤òãÀ®¤·¤¿¡ª", "You just completed your quest!"));
438 * @brief ¸½ºß¥Õ¥í¥¢¤Ë»Ä¤Ã¤Æ¤¤¤ëŨ¥â¥ó¥¹¥¿¡¼¤Î¿ô¤òÊÖ¤¹ /
439 * @return ¸½ºß¤ÎŨ¥â¥ó¥¹¥¿¡¼¤Î¿ô
441 static int count_all_hostile_monsters(void)
446 for (x = 0; x < cur_wid; ++ x)
448 for (y = 0; y < cur_hgt; ++ y)
450 int m_idx = cave[y][x].m_idx;
452 if (m_idx > 0 && is_hostile(&m_list[m_idx]))
463 * @brief ÆÃÄê¤ÎŨ¤òÅݤ·¤¿ºÝ¤Ë¥¯¥¨¥¹¥ÈãÀ®½èÍý /
464 * Check for "Quest" completion when a quest monster is killed or charmed.
465 * @param m_ptr ·âÇˤ·¤¿¥â¥ó¥¹¥¿¡¼¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
468 void check_quest_completion(monster_type *m_ptr)
474 bool create_stairs = FALSE;
480 /* Get the location */
485 quest_num = p_ptr->inside_quest;
487 /* Search for an active quest on this dungeon level */
492 for (i = max_quests - 1; i > 0; i--)
494 quest_type* const q_ptr = &quest[i];
496 /* Quest is not active */
497 if (q_ptr->status != QUEST_STATUS_TAKEN)
500 /* Quest is not a dungeon quest */
501 if (q_ptr->flags & QUEST_FLAG_PRESET)
504 /* Quest is not on this level */
505 if ((q_ptr->level != dun_level) &&
506 (q_ptr->type != QUEST_TYPE_KILL_ANY_LEVEL))
509 /* Not a "kill monster" quest */
510 if ((q_ptr->type == QUEST_TYPE_FIND_ARTIFACT) ||
511 (q_ptr->type == QUEST_TYPE_FIND_EXIT))
514 /* Interesting quest */
515 if ((q_ptr->type == QUEST_TYPE_KILL_NUMBER) ||
516 (q_ptr->type == QUEST_TYPE_TOWER) ||
517 (q_ptr->type == QUEST_TYPE_KILL_ALL))
520 /* Interesting quest */
521 if (((q_ptr->type == QUEST_TYPE_KILL_LEVEL) ||
522 (q_ptr->type == QUEST_TYPE_KILL_ANY_LEVEL) ||
523 (q_ptr->type == QUEST_TYPE_RANDOM)) &&
524 (q_ptr->r_idx == m_ptr->r_idx))
531 /* Handle the current quest */
532 if (quest_num && (quest[quest_num].status == QUEST_STATUS_TAKEN))
535 quest_type* const q_ptr = &quest[quest_num];
539 case QUEST_TYPE_KILL_NUMBER:
543 if (q_ptr->cur_num >= q_ptr->num_mon)
545 complete_quest(quest_num);
551 case QUEST_TYPE_KILL_ALL:
553 if (!is_hostile(m_ptr)) break;
555 if (count_all_hostile_monsters() == 1)
557 if (q_ptr->flags & QUEST_FLAG_SILENT)
559 q_ptr->status = QUEST_STATUS_FINISHED;
563 complete_quest(quest_num);
568 case QUEST_TYPE_KILL_LEVEL:
569 case QUEST_TYPE_RANDOM:
571 /* Only count valid monsters */
572 if (q_ptr->r_idx != m_ptr->r_idx)
577 if (q_ptr->cur_num >= q_ptr->max_num)
579 complete_quest(quest_num);
581 if (!(q_ptr->flags & QUEST_FLAG_PRESET))
583 create_stairs = TRUE;
584 p_ptr->inside_quest = 0;
587 /* Finish the two main quests without rewarding */
588 if ((quest_num == QUEST_OBERON) || (quest_num == QUEST_SERPENT))
590 q_ptr->status = QUEST_STATUS_FINISHED;
593 if (q_ptr->type == QUEST_TYPE_RANDOM)
596 q_ptr->status = QUEST_STATUS_FINISHED;
601 case QUEST_TYPE_KILL_ANY_LEVEL:
604 if (q_ptr->cur_num >= q_ptr->max_num)
606 complete_quest(quest_num);
611 case QUEST_TYPE_TOWER:
613 if (!is_hostile(m_ptr)) break;
615 if (count_all_hostile_monsters() == 1)
617 q_ptr->status = QUEST_STATUS_STAGE_COMPLETED;
619 if((quest[QUEST_TOWER1].status == QUEST_STATUS_STAGE_COMPLETED) &&
620 (quest[QUEST_TOWER2].status == QUEST_STATUS_STAGE_COMPLETED) &&
621 (quest[QUEST_TOWER3].status == QUEST_STATUS_STAGE_COMPLETED))
624 complete_quest(QUEST_TOWER1);
632 /* Create a magical staircase */
638 while (cave_perma_bold(y, x) || cave[y][x].o_idx || (cave[y][x].info & CAVE_OBJECT) )
640 /* Pick a location */
641 scatter(&ny, &nx, y, x, 1, 0);
647 /* Explain the staircase */
649 msg_print("ËâË¡¤Î³¬Ãʤ¬¸½¤ì¤¿...");
651 msg_print("A magical staircase appears...");
655 /* Create stairs down */
656 cave_set_feat(y, x, feat_down_stair);
658 /* Remember to update everything */
659 p_ptr->update |= (PU_FLOW);
669 for (i = 0; i < (dun_level / 15)+1; i++)
671 /* Get local object */
674 /* Wipe the object */
677 /* Make a great object */
678 make_object(q_ptr, AM_GOOD | AM_GREAT);
680 /* Drop it in the dungeon */
681 (void)drop_near(q_ptr, -1, y, x);
687 * @brief ÆÃÄê¤Î¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È¤òÆþ¼ê¤·¤¿ºÝ¤Î¥¯¥¨¥¹¥ÈãÀ®½èÍý /
688 * Check for "Quest" completion when a quest monster is killed or charmed.
689 * @param o_ptr Æþ¼ê¤·¤¿¥ª¥Ö¥¸¥§¥¯¥È¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
692 void check_find_art_quest_completion(object_type *o_ptr)
695 /* Check if completed a quest */
696 for (i = 0; i < max_quests; i++)
698 if ((quest[i].type == QUEST_TYPE_FIND_ARTIFACT) &&
699 (quest[i].status == QUEST_STATUS_TAKEN) &&
700 (quest[i].k_idx == o_ptr->name1))
709 * @brief ¥â¥ó¥¹¥¿¡¼¤ò·âÇˤ·¤¿ºÝ¤Î½Ò¸ì¥á¥Ã¥»¡¼¥¸¤òÊÖ¤¹ /
710 * Return monster death string
711 * @param r_ptr ·âÇˤµ¤ì¤¿¥â¥ó¥¹¥¿¡¼¤Î¼ï²¾ðÊó¤ò»ý¤Ä¹½Â¤ÂΤλ²¾È¥Ý¥¤¥ó¥¿
712 * @return ·âÇˤµ¤ì¤¿¥â¥ó¥¹¥¿¡¼¤Î½Ò¸ì
714 cptr extract_note_dies(monster_race *r_ptr)
716 /* Some monsters get "destroyed" */
717 if (!monster_living(r_ptr))
721 for (i = 0; i < 4; i++)
723 if (r_ptr->blow[i].method == RBM_EXPLODE)
726 return "¤ÏÇúȯ¤·¤ÆÊ´¡¹¤Ë¤Ê¤Ã¤¿¡£";
728 return " explodes into tiny shreds.";
736 return " is destroyed.";
740 /* Assume a default death */
750 * @brief ¥â¥ó¥¹¥¿¡¼¤¬»àË´¤·¤¿»þ¤Î½èÍý /
751 * Handle the "death" of a monster.
752 * @param m_idx »àË´¤·¤¿¥â¥ó¥¹¥¿¡¼¤ÎID
753 * @param drop_item TRUE¤Ê¤é¤Ð¥â¥ó¥¹¥¿¡¼¤Î¥É¥í¥Ã¥×½èÍý¤ò¹Ô¤¦
754 * @return ·âÇˤµ¤ì¤¿¥â¥ó¥¹¥¿¡¼¤Î½Ò¸ì
757 * Disperse treasures centered at the monster location based on the
758 * various flags contained in the monster flags fields.
759 * Check for "Quest" completion when a quest monster is killed.
760 * Note that only the player can induce "monster_death()" on Uniques.
761 * Thus (for now) all Quest monsters should be Uniques.
762 * Note that monsters can now carry objects, and when a monster dies,
763 * it drops all of its objects, which may disappear in crowded rooms.
766 void monster_death(int m_idx, bool drop_item)
775 monster_type *m_ptr = &m_list[m_idx];
777 monster_race *r_ptr = &r_info[m_ptr->r_idx];
779 bool visible = ((m_ptr->ml && !p_ptr->image) || (r_ptr->flags1 & RF1_UNIQUE));
783 bool do_gold = (!(r_ptr->flags1 & RF1_ONLY_ITEM));
784 bool do_item = (!(r_ptr->flags1 & RF1_ONLY_GOLD));
785 bool cloned = (m_ptr->smart & SM_CLONED) ? TRUE : FALSE;
786 int force_coin = get_coin_type(m_ptr->r_idx);
791 bool drop_chosen_item = drop_item && !cloned && !p_ptr->inside_arena
792 && !p_ptr->inside_battle && !is_pet(m_ptr);
794 /* The caster is dead? */
795 if (world_monster && world_monster == m_idx) world_monster = 0;
797 /* Notice changes in view */
798 if (r_ptr->flags7 & (RF7_LITE_MASK | RF7_DARK_MASK))
800 /* Update some things */
801 p_ptr->update |= (PU_MON_LITE);
804 /* Get the location */
808 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
812 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
813 do_cmd_write_nikki(NIKKI_NAMED_PET, 3, m_name);
816 /* Let monsters explode! */
817 for (i = 0; i < 4; i++)
819 if (r_ptr->blow[i].method == RBM_EXPLODE)
821 int flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
822 int typ = mbe_info[r_ptr->blow[i].effect].explode_type;
823 int d_dice = r_ptr->blow[i].d_dice;
824 int d_side = r_ptr->blow[i].d_side;
825 int damage = damroll(d_dice, d_side);
827 project(m_idx, 3, y, x, damage, typ, flg, -1);
832 if (m_ptr->mflag2 & MFLAG2_CHAMELEON)
834 choose_new_monster(m_idx, TRUE, MON_CHAMELEON);
835 r_ptr = &r_info[m_ptr->r_idx];
838 /* Check for quest completion */
839 check_quest_completion(m_ptr);
841 /* Handle the possibility of player vanquishing arena combatant -KMW- */
842 if (p_ptr->inside_arena && !is_pet(m_ptr))
844 p_ptr->exit_bldg = TRUE;
846 if (p_ptr->arena_number > MAX_ARENA_MONS)
849 msg_print("ÁÇÀ²¤é¤·¤¤¡ª·¯¤³¤½¿¿¤Î¾¡Íø¼Ô¤À¡£");
851 msg_print("You are a Genuine Champion!");
857 msg_print("¾¡Íø¡ª¥Á¥ã¥ó¥Ô¥ª¥ó¤Ø¤ÎÆ»¤ò¿Ê¤ó¤Ç¤¤¤ë¡£");
859 msg_print("Victorious! You're on your way to becoming Champion.");
863 if (arena_info[p_ptr->arena_number].tval)
865 /* Get local object */
868 /* Prepare to make a prize */
869 object_prep(q_ptr, lookup_kind(arena_info[p_ptr->arena_number].tval, arena_info[p_ptr->arena_number].sval));
871 apply_magic(q_ptr, object_level, AM_NO_FIXED_ART);
873 /* Drop it in the dungeon */
874 (void)drop_near(q_ptr, -1, y, x);
877 if (p_ptr->arena_number > MAX_ARENA_MONS) p_ptr->arena_number++;
878 p_ptr->arena_number++;
883 /* Extract monster name */
884 monster_desc(m_name, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
886 do_cmd_write_nikki(NIKKI_ARENA, p_ptr->arena_number, m_name);
890 if (m_idx == p_ptr->riding)
892 if (rakuba(-1, FALSE))
895 msg_print("ÃÏÌ̤ËÍî¤È¤µ¤ì¤¿¡£");
897 msg_print("You have fallen from your riding pet.");
902 /* Drop a dead corpse? */
903 if (one_in_(r_ptr->flags1 & RF1_UNIQUE ? 1 : 4) &&
904 (r_ptr->flags9 & (RF9_DROP_CORPSE | RF9_DROP_SKELETON)) &&
905 !(p_ptr->inside_arena || p_ptr->inside_battle || cloned || ((m_ptr->r_idx == today_mon) && is_pet(m_ptr))))
907 /* Assume skeleton */
911 * We cannot drop a skeleton? Note, if we are in this check,
912 * we *know* we can drop at least a corpse or a skeleton
914 if (!(r_ptr->flags9 & RF9_DROP_SKELETON))
916 else if ((r_ptr->flags9 & RF9_DROP_CORPSE) && (r_ptr->flags1 & RF1_UNIQUE))
919 /* Else, a corpse is more likely unless we did a "lot" of damage */
920 else if (r_ptr->flags9 & RF9_DROP_CORPSE)
922 /* Lots of damage in one blow */
923 if ((0 - ((m_ptr->maxhp) / 4)) > m_ptr->hp)
925 if (one_in_(5)) corpse = TRUE;
929 if (!one_in_(5)) corpse = TRUE;
933 /* Get local object */
936 /* Prepare to make an object */
937 object_prep(q_ptr, lookup_kind(TV_CORPSE, (corpse ? SV_CORPSE : SV_SKELETON)));
939 apply_magic(q_ptr, object_level, AM_NO_FIXED_ART);
941 q_ptr->pval = m_ptr->r_idx;
943 /* Drop it in the dungeon */
944 (void)drop_near(q_ptr, -1, y, x);
947 /* Drop objects being carried */
948 monster_drop_carried_objects(m_ptr);
950 if (r_ptr->flags1 & RF1_DROP_GOOD) mo_mode |= AM_GOOD;
951 if (r_ptr->flags1 & RF1_DROP_GREAT) mo_mode |= AM_GREAT;
953 switch (m_ptr->r_idx)
955 case MON_PINK_HORROR:
956 /* Pink horrors are replaced with 2 Blue horrors */
957 if (!(p_ptr->inside_arena || p_ptr->inside_battle))
961 for (i = 0; i < 2; i++)
964 bool pet = is_pet(m_ptr);
967 if (pet) mode |= PM_FORCE_PET;
969 if (summon_specific((pet ? -1 : m_idx), wy, wx, 100, SUMMON_BLUE_HORROR, mode))
971 if (player_can_see_bold(wy, wx))
978 msg_print("¥Ô¥ó¥¯¡¦¥Û¥é¡¼¤ÏʬÎö¤·¤¿¡ª");
980 msg_print("The Pink horror divides!");
985 case MON_BLOODLETTER:
986 /* Bloodletters of Khorne may drop a blade of chaos */
987 if (drop_chosen_item && (randint1(100) < 15))
989 /* Get local object */
992 /* Prepare to make a Blade of Chaos */
993 object_prep(q_ptr, lookup_kind(TV_SWORD, SV_BLADE_OF_CHAOS));
995 apply_magic(q_ptr, object_level, AM_NO_FIXED_ART | mo_mode);
997 /* Drop it in the dungeon */
998 (void)drop_near(q_ptr, -1, y, x);
1003 if (drop_chosen_item && (dun_level > 9))
1005 /* Get local object */
1008 /* Wipe the object */
1011 /* Activate restriction */
1012 if ((dun_level > 49) && one_in_(5))
1013 get_obj_num_hook = kind_is_good_book;
1015 get_obj_num_hook = kind_is_book;
1018 make_object(q_ptr, mo_mode);
1020 /* Drop it in the dungeon */
1021 (void)drop_near(q_ptr, -1, y, x);
1027 * Mega^3-hack: killing a 'Warrior of the Dawn' is likely to
1028 * spawn another in the fallen one's place!
1030 if (!p_ptr->inside_arena && !p_ptr->inside_battle)
1036 bool pet = is_pet(m_ptr);
1040 scatter(&wy, &wx, y, x, 20, 0);
1042 while (!(in_bounds(wy, wx) && cave_empty_bold2(wy, wx)) && --attempts);
1047 if (pet) mode |= PM_FORCE_PET;
1049 if (summon_specific((pet ? -1 : m_idx), wy, wx, 100, SUMMON_DAWN, mode))
1051 if (player_can_see_bold(wy, wx))
1053 msg_print("¿·¤¿¤ÊÀï»Î¤¬¸½¤ì¤¿¡ª");
1055 msg_print("A new warrior steps forth!");
1065 /* One more ultra-hack: An Unmaker goes out with a big bang! */
1067 int flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
1068 (void)project(m_idx, 6, y, x, 100, GF_CHAOS, flg, -1);
1072 case MON_UNICORN_ORD:
1075 /* Reward for "lazy" player */
1076 if (p_ptr->pseikaku == SEIKAKU_NAMAKE)
1079 artifact_type *a_ptr = NULL;
1081 if (!drop_chosen_item) break;
1085 switch (randint0(3))
1088 a_idx = ART_NAMAKE_HAMMER;
1091 a_idx = ART_NAMAKE_BOW;
1094 a_idx = ART_NAMAKE_ARMOR;
1098 a_ptr = &a_info[a_idx];
1100 while (a_ptr->cur_num);
1102 /* Create the artifact */
1103 if (create_named_art(a_idx, y, x))
1107 /* Hack -- Memorize location of artifact in saved floors */
1108 if (character_dungeon) a_ptr->floor_id = p_ptr->floor_id;
1110 else if (!preserve_mode) a_ptr->cur_num = 1;
1115 if (!drop_chosen_item) break;
1117 /* Get local object */
1120 /* Mega-Hack -- Prepare to make "Grond" */
1121 object_prep(q_ptr, lookup_kind(TV_HAFTED, SV_GROND));
1123 /* Mega-Hack -- Mark this item as "Grond" */
1124 q_ptr->name1 = ART_GROND;
1126 /* Mega-Hack -- Actually create "Grond" */
1127 apply_magic(q_ptr, -1, AM_GOOD | AM_GREAT);
1129 /* Drop it in the dungeon */
1130 (void)drop_near(q_ptr, -1, y, x);
1132 /* Get local object */
1135 /* Mega-Hack -- Prepare to make "Chaos" */
1136 object_prep(q_ptr, lookup_kind(TV_CROWN, SV_CHAOS));
1138 /* Mega-Hack -- Mark this item as "Chaos" */
1139 q_ptr->name1 = ART_CHAOS;
1141 /* Mega-Hack -- Actually create "Chaos" */
1142 apply_magic(q_ptr, -1, AM_GOOD | AM_GREAT);
1144 /* Drop it in the dungeon */
1145 (void)drop_near(q_ptr, -1, y, x);
1148 case MON_B_DEATH_SWORD:
1149 if (drop_chosen_item)
1151 /* Get local object */
1154 /* Prepare to make a broken sword */
1155 object_prep(q_ptr, lookup_kind(TV_SWORD, randint1(2)));
1157 /* Drop it in the dungeon */
1158 (void)drop_near(q_ptr, -1, y, x);
1164 if (drop_chosen_item && ((m_ptr->r_idx == MON_A_GOLD) ||
1165 ((m_ptr->r_idx == MON_A_SILVER) && (r_ptr->r_akills % 5 == 0))))
1167 /* Get local object */
1170 /* Prepare to make a Can of Toys */
1171 object_prep(q_ptr, lookup_kind(TV_CHEST, SV_CHEST_KANDUME));
1173 apply_magic(q_ptr, object_level, AM_NO_FIXED_ART);
1175 /* Drop it in the dungeon */
1176 (void)drop_near(q_ptr, -1, y, x);
1182 int flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
1183 (void)project(m_idx, 3, y, x, damroll(20, 10), GF_FIRE, flg, -1);
1188 if (!drop_chosen_item) break;
1190 switch (r_ptr->d_char)
1195 /* Get local object */
1198 /* Wipe the object */
1201 /* Activate restriction */
1202 get_obj_num_hook = kind_is_cloak;
1205 make_object(q_ptr, mo_mode);
1207 /* Drop it in the dungeon */
1208 (void)drop_near(q_ptr, -1, y, x);
1215 /* Get local object */
1218 /* Wipe the object */
1221 /* Activate restriction */
1222 get_obj_num_hook = kind_is_polearm;
1224 /* Make a poleweapon */
1225 make_object(q_ptr, mo_mode);
1227 /* Drop it in the dungeon */
1228 (void)drop_near(q_ptr, -1, y, x);
1235 /* Get local object */
1238 /* Wipe the object */
1241 /* Activate restriction */
1242 get_obj_num_hook = kind_is_armor;
1244 /* Make a hard armor */
1245 make_object(q_ptr, mo_mode);
1247 /* Drop it in the dungeon */
1248 (void)drop_near(q_ptr, -1, y, x);
1255 /* Get local object */
1258 /* Wipe the object */
1261 /* Activate restriction */
1262 get_obj_num_hook = kind_is_hafted;
1264 /* Make a hafted weapon */
1265 make_object(q_ptr, mo_mode);
1267 /* Drop it in the dungeon */
1268 (void)drop_near(q_ptr, -1, y, x);
1273 if (m_ptr->r_idx != MON_STORMBRINGER)
1275 /* Get local object */
1278 /* Wipe the object */
1281 /* Activate restriction */
1282 get_obj_num_hook = kind_is_sword;
1285 make_object(q_ptr, mo_mode);
1287 /* Drop it in the dungeon */
1288 (void)drop_near(q_ptr, -1, y, x);
1295 /* Mega-Hack -- drop fixed items */
1296 if (drop_chosen_item)
1301 switch (m_ptr->r_idx)
1321 case MON_STORMBRINGER:
1322 a_idx = ART_STORMBRINGER;
1327 a_idx = ART_CRIMSON;
1337 a_idx = ART_KUSANAGI;
1367 a_idx = ART_WEREWINDLE;
1375 a_idx = ART_GRAYSWANDIR;
1388 a_idx = ART_TWILIGHT;
1393 a_idx = ART_ORB_OF_FATE;
1399 a_idx = ART_ELENDIL;
1414 a_idx = ART_DESTINY;
1419 a_idx = ART_ZANTETSU;
1434 a_idx = ART_WINBLOWS;
1438 case MON_LUNGORTHIN:
1443 case MON_JACK_SHADOWS:
1449 a_idx = ART_STONEMASK;
1454 a_idx = ART_SOULCRUSH;
1459 a_idx = ART_EXCALIBUR_J;
1464 a_idx = ART_SHUTEN_DOJI;
1469 a_idx = ART_GOTHMOG;
1478 case MON_ROBIN_HOOD:
1479 a_idx = ART_ROBIN_HOOD;
1484 a_idx = ART_NANACHO;
1490 if ((a_idx > 0) && ((randint0(100) < chance) || p_ptr->wizard))
1492 artifact_type *a_ptr = &a_info[a_idx];
1494 if (!a_ptr->cur_num)
1496 /* Create the artifact */
1497 if (create_named_art(a_idx, y, x))
1501 /* Hack -- Memorize location of artifact in saved floors */
1502 if (character_dungeon) a_ptr->floor_id = p_ptr->floor_id;
1504 else if (!preserve_mode) a_ptr->cur_num = 1;
1508 if ((r_ptr->flags7 & RF7_GUARDIAN) && (d_info[dungeon_type].final_guardian == m_ptr->r_idx))
1510 int k_idx = d_info[dungeon_type].final_object ? d_info[dungeon_type].final_object
1511 : lookup_kind(TV_SCROLL, SV_SCROLL_ACQUIREMENT);
1513 if (d_info[dungeon_type].final_artifact)
1515 int a_idx = d_info[dungeon_type].final_artifact;
1516 artifact_type *a_ptr = &a_info[a_idx];
1518 if (!a_ptr->cur_num)
1520 /* Create the artifact */
1521 if (create_named_art(a_idx, y, x))
1525 /* Hack -- Memorize location of artifact in saved floors */
1526 if (character_dungeon) a_ptr->floor_id = p_ptr->floor_id;
1528 else if (!preserve_mode) a_ptr->cur_num = 1;
1530 /* Prevent rewarding both artifact and "default" object */
1531 if (!d_info[dungeon_type].final_object) k_idx = 0;
1537 /* Get local object */
1540 /* Prepare to make a reward */
1541 object_prep(q_ptr, k_idx);
1543 apply_magic(q_ptr, object_level, AM_NO_FIXED_ART | AM_GOOD);
1545 /* Drop it in the dungeon */
1546 (void)drop_near(q_ptr, -1, y, x);
1549 msg_format("¤¢¤Ê¤¿¤Ï%s¤òÀ©ÇƤ·¤¿¡ª",d_name+d_info[dungeon_type].name);
1551 msg_format("You have conquered %s!",d_name+d_info[dungeon_type].name);
1556 /* Determine how much we can drop */
1557 if ((r_ptr->flags1 & RF1_DROP_60) && (randint0(100) < 60)) number++;
1558 if ((r_ptr->flags1 & RF1_DROP_90) && (randint0(100) < 90)) number++;
1559 if (r_ptr->flags1 & RF1_DROP_1D2) number += damroll(1, 2);
1560 if (r_ptr->flags1 & RF1_DROP_2D2) number += damroll(2, 2);
1561 if (r_ptr->flags1 & RF1_DROP_3D2) number += damroll(3, 2);
1562 if (r_ptr->flags1 & RF1_DROP_4D2) number += damroll(4, 2);
1564 if (cloned && !(r_ptr->flags1 & RF1_UNIQUE))
1565 number = 0; /* Clones drop no stuff unless Cloning Pits */
1567 if (is_pet(m_ptr) || p_ptr->inside_battle || p_ptr->inside_arena)
1568 number = 0; /* Pets drop no stuff */
1569 if (!drop_item && (r_ptr->d_char != '$')) number = 0;
1571 if((r_ptr->flags2 & (RF2_MULTIPLY)) && (r_ptr->r_akills > 1024))
1572 number = 0; /* Limit of Multiply monster drop */
1574 /* Hack -- handle creeping coins */
1575 coin_type = force_coin;
1577 /* Average dungeon and monster levels */
1578 object_level = (dun_level + r_ptr->level) / 2;
1580 /* Drop some objects */
1581 for (j = 0; j < number; j++)
1583 /* Get local object */
1586 /* Wipe the object */
1590 if (do_gold && (!do_item || (randint0(100) < 50)))
1592 /* Make some gold */
1593 if (!make_gold(q_ptr)) continue;
1602 /* Make an object */
1603 if (!make_object(q_ptr, mo_mode)) continue;
1609 /* Drop it in the dungeon */
1610 (void)drop_near(q_ptr, -1, y, x);
1613 /* Reset the object level */
1614 object_level = base_level;
1616 /* Reset "coin" type */
1620 /* Take note of any dropped treasure */
1621 if (visible && (dump_item || dump_gold))
1623 /* Take notes on treasure */
1624 lore_treasure(m_idx, dump_item, dump_gold);
1627 /* Only process "Quest Monsters" */
1628 if (!(r_ptr->flags1 & RF1_QUESTOR)) return;
1629 if (p_ptr->inside_battle) return;
1632 if ((m_ptr->r_idx == MON_SERPENT) && !cloned)
1635 p_ptr->total_winner = TRUE;
1637 /* Redraw the "title" */
1638 p_ptr->redraw |= (PR_TITLE);
1641 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "¸«»ö¤ËÊѶòÈÚÅܤξ¡Íø¼Ô¤È¤Ê¤Ã¤¿¡ª");
1643 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "become *WINNER* of Hengband finely!");
1646 if ((p_ptr->pclass == CLASS_CHAOS_WARRIOR) || (p_ptr->muta2 & MUT2_CHAOS_GIFT))
1649 msg_format("%s¤«¤é¤ÎÀ¼¤¬¶Á¤¤¤¿¡£", chaos_patrons[p_ptr->chaos_patron]);
1650 msg_print("¡Ø¤è¤¯¤ä¤Ã¤¿¡¢ÄêÌ¿¤Î¼Ô¤è¡ª¡Ù");
1652 msg_format("The voice of %s booms out:", chaos_patrons[p_ptr->chaos_patron]);
1653 msg_print("'Thou art donst well, mortal!'");
1657 /* Congratulations */
1659 msg_print("*** ¤ª¤á¤Ç¤È¤¦ ***");
1661 msg_print("*** CONGRATULATIONS ***");
1665 msg_print("¤¢¤Ê¤¿¤Ï¥²¡¼¥à¤ò¥³¥ó¥×¥ê¡¼¥È¤·¤Þ¤·¤¿¡£");
1667 msg_print("You have won the game!");
1671 msg_print("½àÈ÷¤¬À°¤Ã¤¿¤é°úÂà(¼«»¦¥³¥Þ¥ó¥É)¤·¤Æ¤â·ë¹½¤Ç¤¹¡£");
1673 msg_print("You may retire (commit suicide) when you are ready.");
1679 * @brief ¥â¥ó¥¹¥¿¡¼¤ËÍ¿¤¨¤¿¥À¥á¡¼¥¸¤Î½¤Àµ½èÍý /
1680 * Modify the physical damage done to the monster.
1681 * @param m_ptr ¥À¥á¡¼¥¸¤ò¼õ¤±¤ë¥â¥ó¥¹¥¿¡¼¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
1682 * @param dam ¥À¥á¡¼¥¸´ðËÜÃÍ
1683 * @param is_psy_spear ¹¶·â¼êÃʤ¬¸÷¤Î·õ¤Ê¤é¤ÐTRUE
1684 * @return ½¤Àµ¤ò¹Ô¤Ã¤¿·ë²Ì¤Î¥À¥á¡¼¥¸ÎÌ
1687 * (for example when it's invulnerable or shielded)
1688 * ToDo: Accept a damage-type to calculate the modified damage from
1689 * things like fire, frost, lightning, poison, ... attacks.
1690 * "type" is not yet used and should be 0.
1693 int mon_damage_mod(monster_type *m_ptr, int dam, bool is_psy_spear)
1695 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1697 if ((r_ptr->flagsr & RFR_RES_ALL) && dam > 0)
1700 if ((dam == 0) && one_in_(3)) dam = 1;
1703 if (MON_INVULNER(m_ptr))
1707 if (!p_ptr->blind && is_seen(m_ptr))
1710 msg_print("¥Ð¥ê¥¢¤òÀÚ¤êÎö¤¤¤¿¡ª");
1712 msg_print("The barrier is penetrated!");
1716 else if (!one_in_(PENETRATE_INVULNERABILITY))
1726 * @brief ¥â¥ó¥¹¥¿¡¼¤ËÍ¿¤¨¤¿¥À¥á¡¼¥¸¤ò¸µ¤Ë·Ð¸³Ãͤò²Ã»»¤¹¤ë /
1727 * Calculate experience point to be get
1728 * @param dam Í¿¤¨¤¿¥À¥á¡¼¥¸ÎÌ
1729 * @param m_ptr ¥À¥á¡¼¥¸¤òÍ¿¤¨¤¿¥â¥ó¥¹¥¿¡¼¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
1733 * Even the 64 bit operation is not big enough to avoid overflaw
1734 * unless we carefully choose orders of multiplication and division.
1735 * Get the coefficient first, and multiply (potentially huge) base
1736 * experience point of a monster later.
1739 static void get_exp_from_mon(int dam, monster_type *m_ptr)
1741 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1748 if (!m_ptr->r_idx) return;
1749 if (is_pet(m_ptr) || p_ptr->inside_battle) return;
1752 * - Ratio of monster's level to player's level effects
1753 * - Varying speed effects
1754 * - Get a fraction in proportion of damage point
1756 new_exp = r_ptr->level * SPEED_TO_ENERGY(m_ptr->mspeed) * dam;
1759 div_l = (p_ptr->max_plv+2) * SPEED_TO_ENERGY(r_ptr->speed);
1761 /* Use (average maxhp * 2) as a denominator */
1762 if (!(r_ptr->flags1 & RF1_FORCE_MAXHP))
1763 s64b_mul(&div_h, &div_l, 0, r_ptr->hdice * (ironman_nightmare ? 2 : 1) * (r_ptr->hside + 1));
1765 s64b_mul(&div_h, &div_l, 0, r_ptr->hdice * (ironman_nightmare ? 2 : 1) * r_ptr->hside * 2);
1767 /* Special penalty in the wilderness */
1768 if (!dun_level && (!(r_ptr->flags8 & RF8_WILD_ONLY) || !(r_ptr->flags1 & RF1_UNIQUE)))
1769 s64b_mul(&div_h, &div_l, 0, 5);
1771 /* Do division first to prevent overflaw */
1772 s64b_div(&new_exp, &new_exp_frac, div_h, div_l);
1774 /* Special penalty for mutiply-monster */
1775 if ((r_ptr->flags2 & RF2_MULTIPLY) || (m_ptr->r_idx == MON_DAWN))
1777 int monnum_penarty = r_ptr->r_akills / 400;
1778 if (monnum_penarty > 8) monnum_penarty = 8;
1780 while (monnum_penarty--)
1783 s64b_RSHIFT(new_exp, new_exp_frac, 2);
1787 /* Special penalty for rest_and_shoot exp scum */
1788 if ((m_ptr->dealt_damage > m_ptr->max_maxhp) && (m_ptr->hp >= 0))
1790 int over_damage = m_ptr->dealt_damage / m_ptr->max_maxhp;
1791 if (over_damage > 32) over_damage = 32;
1793 while (over_damage--)
1796 s64b_mul(&new_exp, &new_exp_frac, 0, 9);
1797 s64b_div(&new_exp, &new_exp_frac, 0, 10);
1801 /* Finally multiply base experience point of the monster */
1802 s64b_mul(&new_exp, &new_exp_frac, 0, r_ptr->mexp);
1804 /* Gain experience */
1805 gain_exp_64(new_exp, new_exp_frac);
1810 * @brief ¥â¥ó¥¹¥¿¡¼¤ÎHP¤ò¥À¥á¡¼¥¸¤Ë±þ¤¸¤Æ¸º»»¤¹¤ë /
1811 * Decreases monsters hit points, handling monster death.
1812 * @param dam Í¿¤¨¤¿¥À¥á¡¼¥¸ÎÌ
1813 * @param m_idx ¥À¥á¡¼¥¸¤òÍ¿¤¨¤¿¥â¥ó¥¹¥¿¡¼¤ÎID
1814 * @param fear ¥À¥á¡¼¥¸¤Ë¤è¤Ã¤Æ¥â¥ó¥¹¥¿¡¼¤¬¶²¹²¾õÂ֤˴٤俤ʤé¤ÐTRUE¤òÊÖ¤¹
1815 * @param note ¥â¥ó¥¹¥¿¡¼¤¬Åݤµ¤ì¤¿ºÝ¤ÎÆÃÊ̤ʥá¥Ã¥»¡¼¥¸½Ò¸ì
1819 * We return TRUE if the monster has been killed (and deleted).
1820 * We announce monster death (using an optional "death message"
1821 * if given, and a otherwise a generic killed/destroyed message).
1822 * Only "physical attacks" can induce the "You have slain" message.
1823 * Missile and Spell attacks will induce the "dies" message, or
1824 * various "specialized" messages. Note that "You have destroyed"
1825 * and "is destroyed" are synonyms for "You have slain" and "dies".
1826 * Hack -- unseen monsters yield "You have killed it." message.
1827 * Added fear (DGK) and check whether to print fear messages -CWS
1828 * Made name, sex, and capitalization generic -BEN-
1829 * As always, the "ghost" processing is a total hack.
1830 * Hack -- we "delay" fear messages by passing around a "fear" flag.
1831 * XXX XXX XXX Consider decreasing monster experience over time, say,
1832 * by using "(m_exp * m_lev * (m_lev)) / (p_lev * (m_lev + n_killed))"
1833 * instead of simply "(m_exp * m_lev) / (p_lev)", to make the first
1834 * monster worth more than subsequent monsters. This would also need
1835 * to induce changes in the monster recall code.
1838 bool mon_take_hit(int m_idx, int dam, bool *fear, cptr note)
1840 monster_type *m_ptr = &m_list[m_idx];
1841 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1843 monster_type exp_mon;
1845 /* Innocent until proven otherwise */
1846 bool innocent = TRUE, thief = FALSE;
1851 (void)COPY(&exp_mon, m_ptr, monster_type);
1853 expdam = (m_ptr->hp > dam) ? dam : m_ptr->hp;
1855 get_exp_from_mon(expdam, &exp_mon);
1857 /* Genocided by chaos patron */
1858 if (!m_ptr->r_idx) m_idx = 0;
1860 /* Redraw (later) if needed */
1861 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1862 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
1865 (void)set_monster_csleep(m_idx, 0);
1867 /* Hack - Cancel any special player stealth magics. -LM- */
1868 if (p_ptr->special_defense & NINJA_S_STEALTH)
1870 set_superstealth(FALSE);
1873 /* Genocided by chaos patron */
1874 if (!m_idx) return TRUE;
1876 /* Remember dealt_damage before this attack*/
1877 dealt_damage = m_ptr->dealt_damage;
1882 m_ptr->dealt_damage += dam;
1883 if(m_ptr->dealt_damage > m_ptr->max_maxhp * 100) m_ptr->dealt_damage = m_ptr->max_maxhp * 100;
1886 msg_format( _("¹ç·×%d/%d¤Î¥À¥á¡¼¥¸¤òÍ¿¤¨¤¿¡£","You do %d (out of %d) damage."),
1887 m_ptr->dealt_damage, m_ptr->maxhp);
1890 /* It is dead now */
1895 if (r_info[m_ptr->r_idx].flags7 & RF7_TANUKI)
1897 /* You might have unmasked Tanuki first time */
1898 r_ptr = &r_info[m_ptr->r_idx];
1899 m_ptr->ap_r_idx = m_ptr->r_idx;
1900 if (r_ptr->r_sights < MAX_SHORT) r_ptr->r_sights++;
1903 if (m_ptr->mflag2 & MFLAG2_CHAMELEON)
1905 /* You might have unmasked Chameleon first time */
1906 r_ptr = real_r_ptr(m_ptr);
1907 if (r_ptr->r_sights < MAX_SHORT) r_ptr->r_sights++;
1910 if (!(m_ptr->smart & SM_CLONED))
1912 /* When the player kills a Unique, it stays dead */
1913 if (r_ptr->flags1 & RF1_UNIQUE)
1917 /* Mega-Hack -- Banor & Lupart */
1918 if ((m_ptr->r_idx == MON_BANOR) || (m_ptr->r_idx == MON_LUPART))
1920 r_info[MON_BANORLUPART].max_num = 0;
1921 r_info[MON_BANORLUPART].r_pkills++;
1922 r_info[MON_BANORLUPART].r_akills++;
1923 if (r_info[MON_BANORLUPART].r_tkills < MAX_SHORT) r_info[MON_BANORLUPART].r_tkills++;
1925 else if (m_ptr->r_idx == MON_BANORLUPART)
1927 r_info[MON_BANOR].max_num = 0;
1928 r_info[MON_BANOR].r_pkills++;
1929 r_info[MON_BANOR].r_akills++;
1930 if (r_info[MON_BANOR].r_tkills < MAX_SHORT) r_info[MON_BANOR].r_tkills++;
1931 r_info[MON_LUPART].max_num = 0;
1932 r_info[MON_LUPART].r_pkills++;
1933 r_info[MON_LUPART].r_akills++;
1934 if (r_info[MON_LUPART].r_tkills < MAX_SHORT) r_info[MON_LUPART].r_tkills++;
1938 /* When the player kills a Nazgul, it stays dead */
1939 else if (r_ptr->flags7 & RF7_NAZGUL) r_ptr->max_num--;
1942 /* Count all monsters killed */
1943 if (r_ptr->r_akills < MAX_SHORT) r_ptr->r_akills++;
1945 /* Recall even invisible uniques or winners */
1946 if ((m_ptr->ml && !p_ptr->image) || (r_ptr->flags1 & RF1_UNIQUE))
1948 /* Count kills this life */
1949 if ((m_ptr->mflag2 & MFLAG2_KAGE) && (r_info[MON_KAGE].r_pkills < MAX_SHORT)) r_info[MON_KAGE].r_pkills++;
1950 else if (r_ptr->r_pkills < MAX_SHORT) r_ptr->r_pkills++;
1952 /* Count kills in all lives */
1953 if ((m_ptr->mflag2 & MFLAG2_KAGE) && (r_info[MON_KAGE].r_tkills < MAX_SHORT)) r_info[MON_KAGE].r_tkills++;
1954 else if (r_ptr->r_tkills < MAX_SHORT) r_ptr->r_tkills++;
1956 /* Hack -- Auto-recall */
1957 monster_race_track(m_ptr->ap_r_idx);
1960 /* Extract monster name */
1961 monster_desc(m_name, m_ptr, MD_TRUE_NAME);
1963 /* Don't kill Amberites */
1964 if ((r_ptr->flags3 & RF3_AMBERITE) && one_in_(2))
1966 int curses = 1 + randint1(3);
1967 bool stop_ty = FALSE;
1971 msg_format("%^s¤Ï¶²¤í¤·¤¤·ì¤Î¼ö¤¤¤ò¤¢¤Ê¤¿¤Ë¤«¤±¤¿¡ª", m_name);
1973 msg_format("%^s puts a terrible blood curse on you!", m_name);
1976 curse_equipment(100, 50);
1980 stop_ty = activate_ty_curse(stop_ty, &count);
1985 if (r_ptr->flags2 & RF2_CAN_SPEAK)
1987 char line_got[1024];
1989 /* Dump a message */
1991 if (!get_rnd_line("mondeath_j.txt", m_ptr->r_idx, line_got))
1993 if (!get_rnd_line("mondeath.txt", m_ptr->r_idx, line_got))
1996 msg_format("%^s %s", m_name, line_got);
1999 if (m_ptr->r_idx == MON_SERPENT)
2001 /* Make screen dump */
2002 screen_dump = make_screen_dump();
2007 if (!(d_info[dungeon_type].flags1 & DF1_BEGINNER))
2009 if (!dun_level && !ambush_flag && !p_ptr->inside_arena)
2011 chg_virtue(V_VALOUR, -1);
2013 else if (r_ptr->level > dun_level)
2015 if (randint1(10) <= (r_ptr->level - dun_level))
2016 chg_virtue(V_VALOUR, 1);
2018 if (r_ptr->level > 60)
2020 chg_virtue(V_VALOUR, 1);
2022 if (r_ptr->level >= 2 * (p_ptr->lev+1))
2023 chg_virtue(V_VALOUR, 2);
2026 if (r_ptr->flags1 & RF1_UNIQUE)
2028 if (r_ptr->flags3 & (RF3_EVIL | RF3_GOOD)) chg_virtue(V_HARMONY, 2);
2030 if (r_ptr->flags3 & RF3_GOOD)
2032 chg_virtue(V_UNLIFE, 2);
2033 chg_virtue(V_VITALITY, -2);
2036 if (one_in_(3)) chg_virtue(V_INDIVIDUALISM, -1);
2039 if (m_ptr->r_idx == MON_BEGGAR || m_ptr->r_idx == MON_LEPER)
2041 chg_virtue(V_COMPASSION, -1);
2044 if ((r_ptr->flags3 & RF3_GOOD) &&
2045 ((r_ptr->level) / 10 + (3 * dun_level) >= randint1(100)))
2046 chg_virtue(V_UNLIFE, 1);
2048 if (r_ptr->d_char == 'A')
2050 if (r_ptr->flags1 & RF1_UNIQUE)
2051 chg_virtue(V_FAITH, -2);
2052 else if ((r_ptr->level) / 10 + (3 * dun_level) >= randint1(100))
2054 if (r_ptr->flags3 & RF3_GOOD) chg_virtue(V_FAITH, -1);
2055 else chg_virtue(V_FAITH, 1);
2058 else if (r_ptr->flags3 & RF3_DEMON)
2060 if (r_ptr->flags1 & RF1_UNIQUE)
2061 chg_virtue(V_FAITH, 2);
2062 else if ((r_ptr->level) / 10 + (3 * dun_level) >= randint1(100))
2063 chg_virtue(V_FAITH, 1);
2066 if ((r_ptr->flags3 & RF3_UNDEAD) && (r_ptr->flags1 & RF1_UNIQUE))
2067 chg_virtue(V_VITALITY, 2);
2069 if (r_ptr->r_deaths)
2071 if (r_ptr->flags1 & RF1_UNIQUE)
2073 chg_virtue(V_HONOUR, 10);
2075 else if ((r_ptr->level) / 10 + (2 * dun_level) >= randint1(100))
2077 chg_virtue(V_HONOUR, 1);
2080 if ((r_ptr->flags2 & RF2_MULTIPLY) && (r_ptr->r_akills > 1000) && one_in_(10))
2082 chg_virtue(V_VALOUR, -1);
2085 for (i = 0; i < 4; i++)
2087 if (r_ptr->blow[i].d_dice != 0) innocent = FALSE; /* Murderer! */
2089 if ((r_ptr->blow[i].effect == RBE_EAT_ITEM)
2090 || (r_ptr->blow[i].effect == RBE_EAT_GOLD))
2092 thief = TRUE; /* Thief! */
2095 /* The new law says it is illegal to live in the dungeon */
2096 if (r_ptr->level != 0) innocent = FALSE;
2100 if (r_ptr->flags1 & RF1_UNIQUE)
2101 chg_virtue(V_JUSTICE, 3);
2102 else if (1+((r_ptr->level) / 10 + (2 * dun_level))
2104 chg_virtue(V_JUSTICE, 1);
2108 chg_virtue (V_JUSTICE, -1);
2111 if ((r_ptr->flags3 & RF3_ANIMAL) && !(r_ptr->flags3 & RF3_EVIL) && !(r_ptr->flags4 & ~(RF4_NOMAGIC_MASK)) && !(r_ptr->flags5 & ~(RF5_NOMAGIC_MASK)) && !(r_ptr->flags6 & ~(RF6_NOMAGIC_MASK)))
2113 if (one_in_(4)) chg_virtue(V_NATURE, -1);
2116 if ((r_ptr->flags1 & RF1_UNIQUE) && record_destroy_uniq)
2120 sprintf(note_buf, "%s%s", r_name + r_ptr->name, (m_ptr->smart & SM_CLONED) ? "(¥¯¥í¡¼¥ó)" : "");
2122 sprintf(note_buf, "%s%s", r_name + r_ptr->name, (m_ptr->smart & SM_CLONED) ? "(Clone)" : "");
2124 do_cmd_write_nikki(NIKKI_UNIQUE, 0, note_buf);
2130 /* Death by Missile/Spell attack */
2133 msg_format("%^s%s", m_name, note);
2136 /* Death by physical attack -- invisible monster */
2137 else if (!m_ptr->ml)
2140 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
2141 msg_format("¤»¤Ã¤«¤¯¤À¤«¤é%s¤ò»¦¤·¤¿¡£", m_name);
2143 msg_format("%s¤ò»¦¤·¤¿¡£", m_name);
2145 msg_format("You have killed %s.", m_name);
2150 /* Death by Physical attack -- non-living monster */
2151 else if (!monster_living(r_ptr))
2154 bool explode = FALSE;
2156 for (i = 0; i < 4; i++)
2158 if (r_ptr->blow[i].method == RBM_EXPLODE) explode = TRUE;
2161 /* Special note at death */
2164 msg_format("%s¤ÏÇúȯ¤·¤ÆÊ´¡¹¤Ë¤Ê¤Ã¤¿¡£", m_name);
2166 msg_format("%^s explodes into tiny shreds.", m_name);
2171 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
2172 msg_format("¤»¤Ã¤«¤¯¤À¤«¤é%s¤òÅݤ·¤¿¡£", m_name);
2174 msg_format("%s¤òÅݤ·¤¿¡£", m_name);
2176 msg_format("You have destroyed %s.", m_name);
2181 /* Death by Physical attack -- living monster */
2185 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
2186 msg_format("¤»¤Ã¤«¤¯¤À¤«¤é%s¤òÁò¤êµî¤Ã¤¿¡£", m_name);
2188 msg_format("%s¤òÁò¤êµî¤Ã¤¿¡£", m_name);
2190 msg_format("You have slain %s.", m_name);
2194 if ((r_ptr->flags1 & RF1_UNIQUE) && !(m_ptr->smart & SM_CLONED) && !vanilla_town)
2196 for (i = 0; i < MAX_KUBI; i++)
2198 if ((kubi_r_idx[i] == m_ptr->r_idx) && !(m_ptr->mflag2 & MFLAG2_CHAMELEON))
2201 msg_format("%s¤Î¼ó¤Ë¤Ï¾Þ¶â¤¬¤«¤«¤Ã¤Æ¤¤¤ë¡£", m_name);
2203 msg_format("There is a price on %s's head.", m_name);
2210 /* Generate treasure */
2211 monster_death(m_idx, TRUE);
2213 /* Mega hack : replace IKETA to BIKETAL */
2214 if ((m_ptr->r_idx == MON_IKETA) &&
2215 !(p_ptr->inside_arena || p_ptr->inside_battle))
2217 int dummy_y = m_ptr->fy;
2218 int dummy_x = m_ptr->fx;
2221 if (is_pet(m_ptr)) mode |= PM_FORCE_PET;
2223 /* Delete the monster */
2224 delete_monster_idx(m_idx);
2226 if (summon_named_creature(0, dummy_y, dummy_x, MON_BIKETAL, mode))
2229 msg_print("¡Ö¥Ï¥¡¥Ã¥Ï¥Ã¥Ï¥Ã¥Ï¡ª¡ª»ä¤¬¥Ð¥¤¥±¥¿¥ë¤À¡ª¡ª¡×");
2231 msg_print("Uwa-hahaha! *I* am Biketal!");
2237 /* Delete the monster */
2238 delete_monster_idx(m_idx);
2241 get_exp_from_mon((long)exp_mon.max_maxhp*2, &exp_mon);
2246 /* Monster is dead */
2253 /* Mega-Hack -- Pain cancels fear */
2254 if (MON_MONFEAR(m_ptr) && (dam > 0))
2257 if (set_monster_monfear(m_idx, MON_MONFEAR(m_ptr) - randint1(dam)))
2264 /* Sometimes a monster gets scared by damage */
2265 if (!MON_MONFEAR(m_ptr) && !(r_ptr->flags3 & (RF3_NO_FEAR)))
2267 /* Percentage of fully healthy */
2268 int percentage = (100L * m_ptr->hp) / m_ptr->maxhp;
2271 * Run (sometimes) if at 10% or less of max hit points,
2272 * or (usually) when hit for half its current hit points
2274 if ((randint1(10) >= percentage) ||
2275 ((dam >= m_ptr->hp) && (randint0(100) < 80)))
2277 /* Hack -- note fear */
2280 /* XXX XXX XXX Hack -- Add some timed fear */
2281 (void)set_monster_monfear(m_idx, (randint1(10) +
2282 (((dam >= m_ptr->hp) && (percentage > 7)) ?
2283 20 : ((11 - percentage) * 5))));
2290 if (p_ptr->riding && (p_ptr->riding == m_idx) && (dam > 0))
2294 /* Extract monster name */
2295 monster_desc(m_name, m_ptr, 0);
2297 if (m_ptr->hp > m_ptr->maxhp/3) dam = (dam + 1) / 2;
2298 if (rakuba((dam > 200) ? 200 : dam, FALSE))
2301 msg_format("%^s¤Ë¿¶¤êÍî¤È¤µ¤ì¤¿¡ª", m_name);
2303 msg_format("%^s has thrown you off!", m_name);
2315 * Get term size and calculate screen size
2317 void get_screen_size(int *wid_p, int *hgt_p)
2319 Term_get_size(wid_p, hgt_p);
2320 *hgt_p -= ROW_MAP + 2;
2321 *wid_p -= COL_MAP + 2;
2322 if (use_bigtile) *wid_p /= 2;
2327 * Calculates current boundaries
2328 * Called below and from "do_cmd_locate()".
2330 void panel_bounds_center(void)
2335 get_screen_size(&wid, &hgt);
2337 panel_row_max = panel_row_min + hgt - 1;
2338 panel_row_prt = panel_row_min - 1;
2339 panel_col_max = panel_col_min + wid - 1;
2340 panel_col_prt = panel_col_min - 13;
2345 * Map resizing whenever the main term changes size
2347 void resize_map(void)
2349 /* Only if the dungeon exists */
2350 if (!character_dungeon) return;
2352 /* Mega-Hack -- no panel yet */
2356 /* Reset the panels */
2357 panel_row_min = cur_hgt;
2358 panel_col_min = cur_wid;
2363 p_ptr->update |= (PU_TORCH | PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
2365 /* Forget lite/view */
2366 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
2368 /* Update lite/view */
2369 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
2371 /* Update monsters */
2372 p_ptr->update |= (PU_MONSTERS);
2374 /* Redraw everything */
2375 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
2377 /* Hack -- update */
2385 * Place the cursor on the player
2387 if (can_save) move_cursor_relative(py, px);
2394 * Redraw a term when it is resized
2396 void redraw_window(void)
2398 /* Only if the dungeon exists */
2399 if (!character_dungeon) return;
2402 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
2405 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
2407 /* Hack -- update */
2416 * Handle a request to change the current panel
2418 * Return TRUE if the panel was changed.
2420 * Also used in do_cmd_locate
2422 bool change_panel(int dy, int dx)
2428 get_screen_size(&wid, &hgt);
2430 /* Apply the motion */
2431 y = panel_row_min + dy * hgt / 2;
2432 x = panel_col_min + dx * wid / 2;
2434 /* Verify the row */
2435 if (y > cur_hgt - hgt) y = cur_hgt - hgt;
2438 /* Verify the col */
2439 if (x > cur_wid - wid) x = cur_wid - wid;
2442 /* Handle "changes" */
2443 if ((y != panel_row_min) || (x != panel_col_min))
2445 /* Save the new panel info */
2449 /* Recalculate the boundaries */
2450 panel_bounds_center();
2453 p_ptr->update |= (PU_MONSTERS);
2456 p_ptr->redraw |= (PR_MAP);
2469 bool change_panel_xy(int y, int x)
2475 get_screen_size(&wid, &hgt);
2477 if (y < panel_row_min) dy = -1;
2478 if (y > panel_row_max) dy = 1;
2479 if (x < panel_col_min) dx = -1;
2480 if (x > panel_col_max) dx = 1;
2482 if (!dy && !dx) return (FALSE);
2484 return change_panel(dy, dx);
2489 * Given an row (y) and col (x), this routine detects when a move
2490 * off the screen has occurred and figures new borders. -RAK-
2492 * "Update" forces a "full update" to take place.
2494 * The map is reprinted if necessary, and "TRUE" is returned.
2496 void verify_panel(void)
2508 get_screen_size(&wid, &hgt);
2510 max_prow_min = cur_hgt - hgt;
2511 max_pcol_min = cur_wid - wid;
2513 /* Bounds checking */
2514 if (max_prow_min < 0) max_prow_min = 0;
2515 if (max_pcol_min < 0) max_pcol_min = 0;
2517 /* Center on player */
2518 if (center_player && (center_running || !running))
2520 /* Center vertically */
2521 prow_min = y - hgt / 2;
2522 if (prow_min < 0) prow_min = 0;
2523 else if (prow_min > max_prow_min) prow_min = max_prow_min;
2525 /* Center horizontally */
2526 pcol_min = x - wid / 2;
2527 if (pcol_min < 0) pcol_min = 0;
2528 else if (pcol_min > max_pcol_min) pcol_min = max_pcol_min;
2532 prow_min = panel_row_min;
2533 pcol_min = panel_col_min;
2535 /* Scroll screen when 2 grids from top/bottom edge */
2536 if (y > panel_row_max - 2)
2538 while (y > prow_min + hgt-1 - 2)
2540 prow_min += (hgt / 2);
2544 if (y < panel_row_min + 2)
2546 while (y < prow_min + 2)
2548 prow_min -= (hgt / 2);
2552 if (prow_min > max_prow_min) prow_min = max_prow_min;
2553 if (prow_min < 0) prow_min = 0;
2555 /* Scroll screen when 4 grids from left/right edge */
2556 if (x > panel_col_max - 4)
2558 while (x > pcol_min + wid-1 - 4)
2560 pcol_min += (wid / 2);
2564 if (x < panel_col_min + 4)
2566 while (x < pcol_min + 4)
2568 pcol_min -= (wid / 2);
2572 if (pcol_min > max_pcol_min) pcol_min = max_pcol_min;
2573 if (pcol_min < 0) pcol_min = 0;
2576 /* Check for "no change" */
2577 if ((prow_min == panel_row_min) && (pcol_min == panel_col_min)) return;
2579 /* Save the new panel info */
2580 panel_row_min = prow_min;
2581 panel_col_min = pcol_min;
2583 /* Hack -- optional disturb on "panel change" */
2584 if (disturb_panel && !center_player) disturb(0, 0);
2586 /* Recalculate the boundaries */
2587 panel_bounds_center();
2590 p_ptr->update |= (PU_MONSTERS);
2593 p_ptr->redraw |= (PR_MAP);
2596 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
2601 * Monster health description
2603 cptr look_mon_desc(monster_type *m_ptr, u32b mode)
2605 monster_race *ap_r_ptr = &r_info[m_ptr->ap_r_idx];
2612 /* Determine if the monster is "living" */
2613 living = monster_living(ap_r_ptr);
2615 /* Calculate a health "percentage" */
2616 perc = 100L * m_ptr->hp / m_ptr->maxhp;
2618 /* Healthy monsters */
2619 if (m_ptr->hp >= m_ptr->maxhp)
2623 desc = living ? "̵½ý" : "̵¥À¥á¡¼¥¸";
2625 desc = living ? "unhurt" : "undamaged";
2630 else if (perc >= 60)
2633 desc = living ? "·Ú½ý" : "¾®¥À¥á¡¼¥¸";
2635 desc = living ? "somewhat wounded" : "somewhat damaged";
2640 else if (perc >= 25)
2643 desc = living ? "Éé½ý" : "Ãæ¥À¥á¡¼¥¸";
2645 desc = living ? "wounded" : "damaged";
2650 else if (perc >= 10)
2653 desc = living ? "½Å½ý" : "Âç¥À¥á¡¼¥¸";
2655 desc = living ? "badly wounded" : "badly damaged";
2663 desc = living ? "Ⱦ»àȾÀ¸" : "Åݤ줫¤±";
2665 desc = living ? "almost dead" : "almost destroyed";
2670 /* Need attitude information? */
2673 /* Full information is not needed */
2676 else if (is_pet(m_ptr))
2679 attitude = ", ¥Ú¥Ã¥È";
2684 else if (is_friendly(m_ptr))
2687 attitude = ", ͧ¹¥Åª";
2689 attitude = ", friendly";
2702 /* Clone monster? */
2703 if (m_ptr->smart & SM_CLONED)
2712 /* Display monster's level --- idea borrowed from ToME */
2713 if (ap_r_ptr->r_tkills && !(m_ptr->mflag2 & MFLAG2_KAGE))
2716 return format("¥ì¥Ù¥ë%d, %s%s%s", ap_r_ptr->level, desc, attitude, clone);
2718 return format("Level %d, %s%s%s", ap_r_ptr->level, desc, attitude, clone);
2724 return format("¥ì¥Ù¥ë???, %s%s%s", desc, attitude, clone);
2726 return format("Level ???, %s%s%s", desc, attitude, clone);
2734 * Angband sorting algorithm -- quick sort in place
2736 * Note that the details of the data we are sorting is hidden,
2737 * and we rely on the "ang_sort_comp()" and "ang_sort_swap()"
2738 * function hooks to interact with the data, which is given as
2739 * two pointers, and which may have any user-defined form.
2741 void ang_sort_aux(vptr u, vptr v, int p, int q)
2759 while (!(*ang_sort_comp)(u, v, b, z)) b--;
2762 while (!(*ang_sort_comp)(u, v, z, a)) a++;
2764 /* Done partition */
2768 (*ang_sort_swap)(u, v, a, b);
2774 /* Recurse left side */
2775 ang_sort_aux(u, v, p, b);
2777 /* Recurse right side */
2778 ang_sort_aux(u, v, b+1, q);
2783 * Angband sorting algorithm -- quick sort in place
2785 * Note that the details of the data we are sorting is hidden,
2786 * and we rely on the "ang_sort_comp()" and "ang_sort_swap()"
2787 * function hooks to interact with the data, which is given as
2788 * two pointers, and which may have any user-defined form.
2790 void ang_sort(vptr u, vptr v, int n)
2792 /* Sort the array */
2793 ang_sort_aux(u, v, 0, n-1);
2798 /*** Targeting Code ***/
2802 * Determine is a monster makes a reasonable target
2804 * The concept of "targeting" was stolen from "Morgul" (?)
2806 * The player can target any location, or any "target-able" monster.
2808 * Currently, a monster is "target_able" if it is visible, and if
2809 * the player can hit it with a projection, and the player is not
2810 * hallucinating. This allows use of "use closest target" macros.
2812 * Future versions may restrict the ability to target "trappers"
2813 * and "mimics", but the semantics is a little bit weird.
2815 bool target_able(int m_idx)
2817 monster_type *m_ptr = &m_list[m_idx];
2819 /* Monster must be alive */
2820 if (!m_ptr->r_idx) return (FALSE);
2822 /* Hack -- no targeting hallucinations */
2823 if (p_ptr->image) return (FALSE);
2825 /* Monster must be visible */
2826 if (!m_ptr->ml) return (FALSE);
2828 if (p_ptr->riding && (p_ptr->riding == m_idx)) return (TRUE);
2830 /* Monster must be projectable */
2831 if (!projectable(py, px, m_ptr->fy, m_ptr->fx)) return (FALSE);
2833 /* XXX XXX XXX Hack -- Never target trappers */
2834 /* if (CLEAR_ATTR && (CLEAR_CHAR)) return (FALSE); */
2844 * Update (if necessary) and verify (if possible) the target.
2846 * We return TRUE if the target is "okay" and FALSE otherwise.
2848 bool target_okay(void)
2850 /* Accept stationary targets */
2851 if (target_who < 0) return (TRUE);
2853 /* Check moving targets */
2856 /* Accept reasonable targets */
2857 if (target_able(target_who))
2859 monster_type *m_ptr = &m_list[target_who];
2861 /* Acquire monster location */
2862 target_row = m_ptr->fy;
2863 target_col = m_ptr->fx;
2870 /* Assume no target */
2876 * Sorting hook -- comp function -- by "distance to player"
2878 * We use "u" and "v" to point to arrays of "x" and "y" positions,
2879 * and sort the arrays by double-distance to the player.
2881 static bool ang_sort_comp_distance(vptr u, vptr v, int a, int b)
2883 byte *x = (byte*)(u);
2884 byte *y = (byte*)(v);
2888 /* Absolute distance components */
2889 kx = x[a]; kx -= px; kx = ABS(kx);
2890 ky = y[a]; ky -= py; ky = ABS(ky);
2892 /* Approximate Double Distance to the first point */
2893 da = ((kx > ky) ? (kx + kx + ky) : (ky + ky + kx));
2895 /* Absolute distance components */
2896 kx = x[b]; kx -= px; kx = ABS(kx);
2897 ky = y[b]; ky -= py; ky = ABS(ky);
2899 /* Approximate Double Distance to the first point */
2900 db = ((kx > ky) ? (kx + kx + ky) : (ky + ky + kx));
2902 /* Compare the distances */
2908 * Sorting hook -- comp function -- by importance level of grids
2910 * We use "u" and "v" to point to arrays of "x" and "y" positions,
2911 * and sort the arrays by level of monster
2913 static bool ang_sort_comp_importance(vptr u, vptr v, int a, int b)
2915 byte *x = (byte*)(u);
2916 byte *y = (byte*)(v);
2917 cave_type *ca_ptr = &cave[y[a]][x[a]];
2918 cave_type *cb_ptr = &cave[y[b]][x[b]];
2919 monster_type *ma_ptr = &m_list[ca_ptr->m_idx];
2920 monster_type *mb_ptr = &m_list[cb_ptr->m_idx];
2921 monster_race *ap_ra_ptr, *ap_rb_ptr;
2923 /* The player grid */
2924 if (y[a] == py && x[a] == px) return TRUE;
2925 if (y[b] == py && x[b] == px) return FALSE;
2927 /* Extract monster race */
2928 if (ca_ptr->m_idx && ma_ptr->ml) ap_ra_ptr = &r_info[ma_ptr->ap_r_idx];
2929 else ap_ra_ptr = NULL;
2930 if (cb_ptr->m_idx && mb_ptr->ml) ap_rb_ptr = &r_info[mb_ptr->ap_r_idx];
2931 else ap_rb_ptr = NULL;
2933 if (ap_ra_ptr && !ap_rb_ptr) return TRUE;
2934 if (!ap_ra_ptr && ap_rb_ptr) return FALSE;
2936 /* Compare two monsters */
2937 if (ap_ra_ptr && ap_rb_ptr)
2939 /* Unique monsters first */
2940 if ((ap_ra_ptr->flags1 & RF1_UNIQUE) && !(ap_rb_ptr->flags1 & RF1_UNIQUE)) return TRUE;
2941 if (!(ap_ra_ptr->flags1 & RF1_UNIQUE) && (ap_rb_ptr->flags1 & RF1_UNIQUE)) return FALSE;
2943 /* Shadowers first (¤¢¤ä¤·¤¤±Æ) */
2944 if ((ma_ptr->mflag2 & MFLAG2_KAGE) && !(mb_ptr->mflag2 & MFLAG2_KAGE)) return TRUE;
2945 if (!(ma_ptr->mflag2 & MFLAG2_KAGE) && (mb_ptr->mflag2 & MFLAG2_KAGE)) return FALSE;
2947 /* Unknown monsters first */
2948 if (!ap_ra_ptr->r_tkills && ap_rb_ptr->r_tkills) return TRUE;
2949 if (ap_ra_ptr->r_tkills && !ap_rb_ptr->r_tkills) return FALSE;
2951 /* Higher level monsters first (if known) */
2952 if (ap_ra_ptr->r_tkills && ap_rb_ptr->r_tkills)
2954 if (ap_ra_ptr->level > ap_rb_ptr->level) return TRUE;
2955 if (ap_ra_ptr->level < ap_rb_ptr->level) return FALSE;
2958 /* Sort by index if all conditions are same */
2959 if (ma_ptr->ap_r_idx > mb_ptr->ap_r_idx) return TRUE;
2960 if (ma_ptr->ap_r_idx < mb_ptr->ap_r_idx) return FALSE;
2963 /* An object get higher priority */
2964 if (cave[y[a]][x[a]].o_idx && !cave[y[b]][x[b]].o_idx) return TRUE;
2965 if (!cave[y[a]][x[a]].o_idx && cave[y[b]][x[b]].o_idx) return FALSE;
2967 /* Priority from the terrain */
2968 if (f_info[ca_ptr->feat].priority > f_info[cb_ptr->feat].priority) return TRUE;
2969 if (f_info[ca_ptr->feat].priority < f_info[cb_ptr->feat].priority) return FALSE;
2971 /* If all conditions are same, compare distance */
2972 return ang_sort_comp_distance(u, v, a, b);
2977 * Sorting hook -- swap function -- by "distance to player"
2979 * We use "u" and "v" to point to arrays of "x" and "y" positions,
2980 * and sort the arrays by distance to the player.
2982 static void ang_sort_swap_distance(vptr u, vptr v, int a, int b)
2984 byte *x = (byte*)(u);
2985 byte *y = (byte*)(v);
3003 * Hack -- help "select" a location (see below)
3005 static s16b target_pick(int y1, int x1, int dy, int dx)
3009 int x2, y2, x3, y3, x4, y4;
3011 int b_i = -1, b_v = 9999;
3014 /* Scan the locations */
3015 for (i = 0; i < temp_n; i++)
3021 /* Directed distance */
3025 /* Verify quadrant */
3026 if (dx && (x3 * dx <= 0)) continue;
3027 if (dy && (y3 * dy <= 0)) continue;
3029 /* Absolute distance */
3033 /* Verify quadrant */
3034 if (dy && !dx && (x4 > y4)) continue;
3035 if (dx && !dy && (y4 > x4)) continue;
3037 /* Approximate Double Distance */
3038 v = ((x4 > y4) ? (x4 + x4 + y4) : (y4 + y4 + x4));
3040 /* XXX XXX XXX Penalize location */
3043 if ((b_i >= 0) && (v >= b_v)) continue;
3055 * Hack -- determine if a given location is "interesting"
3057 static bool target_set_accept(int y, int x)
3061 s16b this_o_idx, next_o_idx = 0;
3064 if (!(in_bounds(y, x))) return (FALSE);
3066 /* Player grid is always interesting */
3067 if (player_bold(y, x)) return (TRUE);
3070 /* Handle hallucination */
3071 if (p_ptr->image) return (FALSE);
3074 /* Examine the grid */
3075 c_ptr = &cave[y][x];
3077 /* Visible monsters */
3080 monster_type *m_ptr = &m_list[c_ptr->m_idx];
3082 /* Visible monsters */
3083 if (m_ptr->ml) return (TRUE);
3086 /* Scan all objects in the grid */
3087 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
3091 /* Acquire object */
3092 o_ptr = &o_list[this_o_idx];
3094 /* Acquire next object */
3095 next_o_idx = o_ptr->next_o_idx;
3097 /* Memorized object */
3098 if (o_ptr->marked & OM_FOUND) return (TRUE);
3101 /* Interesting memorized features */
3102 if (c_ptr->info & (CAVE_MARK))
3104 /* Notice object features */
3105 if (c_ptr->info & CAVE_OBJECT) return (TRUE);
3107 /* Feature code (applying "mimic" field) */
3108 if (have_flag(f_info[get_feat_mimic(c_ptr)].flags, FF_NOTICE)) return TRUE;
3117 * Prepare the "temp" array for "target_set"
3119 * Return the number of target_able monsters in the set.
3121 static void target_set_prepare(int mode)
3124 int min_hgt, max_hgt, min_wid, max_wid;
3126 if (mode & TARGET_KILL)
3129 min_hgt = MAX((py - MAX_RANGE), 0);
3130 max_hgt = MIN((py + MAX_RANGE), cur_hgt - 1);
3131 min_wid = MAX((px - MAX_RANGE), 0);
3132 max_wid = MIN((px + MAX_RANGE), cur_wid - 1);
3134 else /* not targetting */
3137 min_hgt = panel_row_min;
3138 max_hgt = panel_row_max;
3139 min_wid = panel_col_min;
3140 max_wid = panel_col_max;
3143 /* Reset "temp" array */
3146 /* Scan the current panel */
3147 for (y = min_hgt; y <= max_hgt; y++)
3149 for (x = min_wid; x <= max_wid; x++)
3153 /* Require "interesting" contents */
3154 if (!target_set_accept(y, x)) continue;
3156 c_ptr = &cave[y][x];
3158 /* Require target_able monsters for "TARGET_KILL" */
3159 if ((mode & (TARGET_KILL)) && !target_able(c_ptr->m_idx)) continue;
3161 if ((mode & (TARGET_KILL)) && !target_pet && is_pet(&m_list[c_ptr->m_idx])) continue;
3163 /* Save the location */
3170 /* Set the sort hooks */
3171 if (mode & (TARGET_KILL))
3173 /* Target the nearest monster for shooting */
3174 ang_sort_comp = ang_sort_comp_distance;
3175 ang_sort_swap = ang_sort_swap_distance;
3179 /* Look important grids first in Look command */
3180 ang_sort_comp = ang_sort_comp_importance;
3181 ang_sort_swap = ang_sort_swap_distance;
3184 /* Sort the positions */
3185 ang_sort(temp_x, temp_y, temp_n);
3187 if (p_ptr->riding && target_pet && (temp_n > 1) && (mode & (TARGET_KILL)))
3192 temp_y[0] = temp_y[1];
3195 temp_x[0] = temp_x[1];
3199 void target_set_prepare_look(){
3200 target_set_prepare(TARGET_LOOK);
3205 * Evaluate number of kill needed to gain level
3207 static void evaluate_monster_exp(char *buf, monster_type *m_ptr)
3209 monster_race *ap_r_ptr = &r_info[m_ptr->ap_r_idx];
3211 s32b exp_mon, exp_adv;
3212 u32b exp_mon_frac, exp_adv_frac;
3214 if ((p_ptr->lev >= PY_MAX_LEVEL) || (p_ptr->prace == RACE_ANDROID))
3219 else if (!ap_r_ptr->r_tkills || (m_ptr->mflag2 & MFLAG2_KAGE))
3229 /* The monster's experience point (assuming average monster speed) */
3230 exp_mon = ap_r_ptr->mexp * ap_r_ptr->level;
3232 s64b_div(&exp_mon, &exp_mon_frac, 0, (p_ptr->max_plv + 2));
3235 /* Total experience value for next level */
3236 exp_adv = player_exp[p_ptr->lev -1] * p_ptr->expfact;
3238 s64b_div(&exp_adv, &exp_adv_frac, 0, 100);
3240 /* Experience value need to get */
3241 s64b_sub(&exp_adv, &exp_adv_frac, p_ptr->exp, p_ptr->exp_frac);
3244 /* You need to kill at least one monster to get any experience */
3245 s64b_add(&exp_adv, &exp_adv_frac, exp_mon, exp_mon_frac);
3246 s64b_sub(&exp_adv, &exp_adv_frac, 0, 1);
3248 /* Extract number of monsters needed */
3249 s64b_div(&exp_adv, &exp_adv_frac, exp_mon, exp_mon_frac);
3251 /* If 999 or more monsters needed, only display "999". */
3252 num = MIN(999, exp_adv_frac);
3254 /* Display the number */
3255 sprintf(buf,"%03ld", (long int)num);
3259 bool show_gold_on_floor = FALSE;
3262 * Examine a grid, return a keypress.
3264 * The "mode" argument contains the "TARGET_LOOK" bit flag, which
3265 * indicates that the "space" key should scan through the contents
3266 * of the grid, instead of simply returning immediately. This lets
3267 * the "look" command get complete information, without making the
3268 * "target" command annoying.
3270 * The "info" argument contains the "commands" which should be shown
3271 * inside the "[xxx]" text. This string must never be empty, or grids
3272 * containing monsters will be displayed with an extra comma.
3274 * Note that if a monster is in the grid, we update both the monster
3275 * recall info and the health bar info to track that monster.
3277 * Eventually, we may allow multiple objects per grid, or objects
3278 * and terrain features in the same grid. XXX XXX XXX
3280 * This function must handle blindness/hallucination.
3282 static int target_set_aux(int y, int x, int mode, cptr info)
3284 cave_type *c_ptr = &cave[y][x];
3285 s16b this_o_idx, next_o_idx = 0;
3286 cptr s1 = "", s2 = "", s3 = "", x_info = "";
3289 feature_type *f_ptr;
3291 char out_val[MAX_NLEN+80];
3293 #ifdef ALLOW_EASY_FLOOR
3294 int floor_list[23], floor_num = 0;
3296 /* Scan all objects in the grid */
3299 floor_num = scan_floor(floor_list, y, x, 0x02);
3311 #endif /* ALLOW_EASY_FLOOR */
3313 /* Hack -- under the player */
3314 if (player_bold(y, x))
3337 /* Hack -- hallucination */
3341 cptr name = "²¿¤«´ñ̯¤Êʪ";
3343 cptr name = "something strange";
3347 /* Display a message */
3349 sprintf(out_val, "%s%s%s%s [%s]", s1, name, s2, s3, info);
3351 sprintf(out_val, "%s%s%s%s [%s]", s1, s2, s3, name, info);
3355 move_cursor_relative(y, x);
3358 /* Stop on everything but "return" */
3359 if ((query != '\r') && (query != '\n')) return query;
3361 /* Repeat forever */
3366 /* Actual monsters */
3367 if (c_ptr->m_idx && m_list[c_ptr->m_idx].ml)
3369 monster_type *m_ptr = &m_list[c_ptr->m_idx];
3370 monster_race *ap_r_ptr = &r_info[m_ptr->ap_r_idx];
3372 bool recall = FALSE;
3377 /* Get the monster name ("a kobold") */
3378 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
3380 /* Hack -- track this monster race */
3381 monster_race_track(m_ptr->ap_r_idx);
3383 /* Hack -- health bar for this monster */
3384 health_track(c_ptr->m_idx);
3386 /* Hack -- handle stuff */
3400 /* Recall on screen */
3401 screen_roff(m_ptr->ap_r_idx, 0);
3403 /* Hack -- Complete the prompt (again) */
3405 Term_addstr(-1, TERM_WHITE, format(" [r»× %s%s]", x_info, info));
3407 Term_addstr(-1, TERM_WHITE, format(" [r,%s%s]", x_info, info));
3416 /* Normal commands */
3417 if (query != 'r') break;
3422 /* Cleare recall text and repeat */
3428 /* Describe, and prompt for recall */
3429 evaluate_monster_exp(acount, m_ptr);
3432 sprintf(out_val, "[%s]%s%s(%s)%s%s [r»× %s%s]", acount, s1, m_name, look_mon_desc(m_ptr, 0x01), s2, s3, x_info, info);
3434 sprintf(out_val, "[%s]%s%s%s%s(%s) [r, %s%s]", acount, s1, s2, s3, m_name, look_mon_desc(m_ptr, 0x01), x_info, info);
3440 move_cursor_relative(y, x);
3445 /* Normal commands */
3446 if (query != 'r') break;
3452 /* Always stop at "normal" keys */
3453 if ((query != '\r') && (query != '\n') && (query != ' ') && (query != 'x')) return query;
3455 /* Sometimes stop at "space" key */
3456 if ((query == ' ') && !(mode & (TARGET_LOOK))) return query;
3458 /* Change the intro */
3466 /* Hack -- take account of gender */
3468 if (ap_r_ptr->flags1 & (RF1_FEMALE)) s1 = "Èà½÷¤Ï";
3470 if (ap_r_ptr->flags1 & (RF1_FEMALE)) s1 = "She is ";
3474 else if (ap_r_ptr->flags1 & (RF1_MALE)) s1 = "Èà¤Ï";
3476 else if (ap_r_ptr->flags1 & (RF1_MALE)) s1 = "He is ";
3480 /* Use a preposition */
3489 /* Scan all objects being carried */
3490 for (this_o_idx = m_ptr->hold_o_idx; this_o_idx; this_o_idx = next_o_idx)
3492 char o_name[MAX_NLEN];
3496 /* Acquire object */
3497 o_ptr = &o_list[this_o_idx];
3499 /* Acquire next object */
3500 next_o_idx = o_ptr->next_o_idx;
3502 /* Obtain an object description */
3503 object_desc(o_name, o_ptr, 0);
3505 /* Describe the object */
3507 sprintf(out_val, "%s%s%s%s[%s]", s1, o_name, s2, s3, info);
3509 sprintf(out_val, "%s%s%s%s [%s]", s1, s2, s3, o_name, info);
3513 move_cursor_relative(y, x);
3516 /* Always stop at "normal" keys */
3517 if ((query != '\r') && (query != '\n') && (query != ' ') && (query != 'x')) return query;
3519 /* Sometimes stop at "space" key */
3520 if ((query == ' ') && !(mode & (TARGET_LOOK))) return query;
3522 /* Change the intro */
3526 s2 = "also carrying ";
3530 /* Use a preposition */
3540 #ifdef ALLOW_EASY_FLOOR
3549 char o_name[MAX_NLEN];
3553 /* Acquire object */
3554 o_ptr = &o_list[floor_list[0]];
3556 /* Describe the object */
3557 object_desc(o_name, o_ptr, 0);
3561 sprintf(out_val, "%s%s%s%s[%s]",
3562 s1, o_name, s2, s3, info);
3564 sprintf(out_val, "%s%s%s%s [%s]",
3565 s1, s2, s3, o_name, info);
3569 move_cursor_relative(y, x);
3578 /* Provide one cushion before item listing */
3581 /* Display rough information about items */
3583 sprintf(out_val, "%s %d¸Ä¤Î¥¢¥¤¥Æ¥à%s%s ['x'¤Ç°ìÍ÷, %s]",
3584 s1, floor_num, s2, s3, info);
3586 sprintf(out_val, "%s%s%sa pile of %d items [x,%s]",
3587 s1, s2, s3, floor_num, info);
3591 move_cursor_relative(y, x);
3596 /* No request for listing */
3597 if (query != 'x' && query != ' ') return query;
3601 /** Display list of items **/
3603 /* Continue scrolling list if requested */
3612 show_gold_on_floor = TRUE;
3613 (void)show_floor(0, y, x, &min_width);
3614 show_gold_on_floor = FALSE;
3618 sprintf(out_val, "%s %d¸Ä¤Î¥¢¥¤¥Æ¥à%s%s [Enter¤Ç¼¡¤Ø, %s]",
3619 s1, floor_num, s2, s3, info);
3621 sprintf(out_val, "%s%s%sa pile of %d items [Enter,%s]",
3622 s1, s2, s3, floor_num, info);
3633 /* Exit unless 'Enter' */
3634 if (query != '\n' && query != '\r')
3639 /* Get the object being moved. */
3640 o_idx = c_ptr->o_idx;
3642 /* Only rotate a pile of two or more objects. */
3643 if (!(o_idx && o_list[o_idx].next_o_idx)) continue;
3645 /* Remove the first object from the list. */
3646 excise_object_idx(o_idx);
3648 /* Find end of the list. */
3650 while (o_list[i].next_o_idx)
3651 i = o_list[i].next_o_idx;
3653 /* Add after the last object. */
3654 o_list[i].next_o_idx = o_idx;
3656 /* Loop and re-display the list */
3662 #endif /* ALLOW_EASY_FLOOR */
3665 /* Scan all objects in the grid */
3666 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
3670 /* Acquire object */
3671 o_ptr = &o_list[this_o_idx];
3673 /* Acquire next object */
3674 next_o_idx = o_ptr->next_o_idx;
3677 if (o_ptr->marked & OM_FOUND)
3679 char o_name[MAX_NLEN];
3684 /* Obtain an object description */
3685 object_desc(o_name, o_ptr, 0);
3687 /* Describe the object */
3689 sprintf(out_val, "%s%s%s%s[%s]", s1, o_name, s2, s3, info);
3691 sprintf(out_val, "%s%s%s%s [%s]", s1, s2, s3, o_name, info);
3695 move_cursor_relative(y, x);
3698 /* Always stop at "normal" keys */
3699 if ((query != '\r') && (query != '\n') && (query != ' ') && (query != 'x')) return query;
3701 /* Sometimes stop at "space" key */
3702 if ((query == ' ') && !(mode & TARGET_LOOK)) return query;
3704 /* Change the intro */
3714 if (o_ptr->number != 1) s1 = "¤½¤ì¤é¤Ï";
3716 if (o_ptr->number != 1) s1 = "They are ";
3732 /* Feature code (applying "mimic" field) */
3733 feat = get_feat_mimic(c_ptr);
3735 /* Require knowledge about grid, or ability to see grid */
3736 if (!(c_ptr->info & CAVE_MARK) && !player_can_see_bold(y, x))
3738 /* Forget feature */
3742 f_ptr = &f_info[feat];
3744 /* Terrain feature if needed */
3745 if (boring || have_flag(f_ptr->flags, FF_REMEMBER))
3749 /* Hack -- special handling for quest entrances */
3750 if (have_flag(f_ptr->flags, FF_QUEST_ENTER))
3752 /* Set the quest number temporary */
3753 int old_quest = p_ptr->inside_quest;
3756 /* Clear the text */
3757 for (j = 0; j < 10; j++) quest_text[j][0] = '\0';
3758 quest_text_line = 0;
3760 p_ptr->inside_quest = c_ptr->special;
3762 /* Get the quest text */
3763 init_flags = INIT_NAME_ONLY;
3765 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
3768 name = format("¥¯¥¨¥¹¥È¡Ö%s¡×(%d³¬ÁêÅö)", quest[c_ptr->special].name, quest[c_ptr->special].level);
3770 name = format("the entrance to the quest '%s'(level %d)", quest[c_ptr->special].name, quest[c_ptr->special].level);
3773 /* Reset the old quest number */
3774 p_ptr->inside_quest = old_quest;
3777 /* Hack -- special handling for building doors */
3778 else if (have_flag(f_ptr->flags, FF_BLDG) && !p_ptr->inside_arena)
3780 name = building[f_ptr->subtype].name;
3782 else if (have_flag(f_ptr->flags, FF_ENTRANCE))
3785 name = format("%s(%d³¬ÁêÅö)", d_text + d_info[c_ptr->special].text, d_info[c_ptr->special].mindepth);
3787 name = format("%s(level %d)", d_text + d_info[c_ptr->special].text, d_info[c_ptr->special].mindepth);
3790 else if (have_flag(f_ptr->flags, FF_TOWN))
3792 name = town[c_ptr->special].name;
3794 else if (p_ptr->wild_mode && (feat == feat_floor))
3804 name = f_name + f_ptr->name;
3810 ((!have_flag(f_ptr->flags, FF_MOVE) && !have_flag(f_ptr->flags, FF_CAN_FLY)) ||
3811 (!have_flag(f_ptr->flags, FF_LOS) && !have_flag(f_ptr->flags, FF_TREE)) ||
3812 have_flag(f_ptr->flags, FF_TOWN)))
3821 /* Hack -- special introduction for store & building doors -KMW- */
3822 if (have_flag(f_ptr->flags, FF_STORE) ||
3823 have_flag(f_ptr->flags, FF_QUEST_ENTER) ||
3824 (have_flag(f_ptr->flags, FF_BLDG) && !p_ptr->inside_arena) ||
3825 have_flag(f_ptr->flags, FF_ENTRANCE))
3834 else if (have_flag(f_ptr->flags, FF_FLOOR) ||
3835 have_flag(f_ptr->flags, FF_TOWN) ||
3836 have_flag(f_ptr->flags, FF_SHALLOW) ||
3837 have_flag(f_ptr->flags, FF_DEEP))
3843 /* Pick proper indefinite article */
3844 s3 = (is_a_vowel(name[0])) ? "an " : "a ";
3848 /* Display a message */
3852 if (c_ptr->mimic) sprintf(f_idx_str, "%d/%d", c_ptr->feat, c_ptr->mimic);
3853 else sprintf(f_idx_str, "%d", c_ptr->feat);
3855 sprintf(out_val, "%s%s%s%s[%s] %x %s %d %d %d (%d,%d) %d", s1, name, s2, s3, info, c_ptr->info, f_idx_str, c_ptr->dist, c_ptr->cost, c_ptr->when, y, x, travel.cost[y][x]);
3857 sprintf(out_val, "%s%s%s%s [%s] %x %s %d %d %d (%d,%d)", s1, s2, s3, name, info, c_ptr->info, f_idx_str, c_ptr->dist, c_ptr->cost, c_ptr->when, y, x);
3862 sprintf(out_val, "%s%s%s%s[%s]", s1, name, s2, s3, info);
3864 sprintf(out_val, "%s%s%s%s [%s]", s1, s2, s3, name, info);
3868 move_cursor_relative(y, x);
3871 /* Always stop at "normal" keys */
3872 if ((query != '\r') && (query != '\n') && (query != ' ')) return query;
3875 /* Stop on everything but "return" */
3876 if ((query != '\r') && (query != '\n')) return query;
3878 /* Repeat forever */
3884 * Handle "target" and "look".
3886 * Note that this code can be called from "get_aim_dir()".
3888 * All locations must be on the current panel. Consider the use of
3889 * "panel_bounds()" to allow "off-panel" targets, perhaps by using
3890 * some form of "scrolling" the map around the cursor. XXX XXX XXX
3891 * That is, consider the possibility of "auto-scrolling" the screen
3892 * while the cursor moves around. This may require changes in the
3893 * "update_mon()" code to allow "visibility" even if off panel, and
3894 * may require dynamic recalculation of the "temp" grid set.
3896 * Hack -- targeting/observing an "outer border grid" may induce
3897 * problems, so this is not currently allowed.
3899 * The player can use the direction keys to move among "interesting"
3900 * grids in a heuristic manner, or the "space", "+", and "-" keys to
3901 * move through the "interesting" grids in a sequential manner, or
3902 * can enter "location" mode, and use the direction keys to move one
3903 * grid at a time in any direction. The "t" (set target) command will
3904 * only target a monster (as opposed to a location) if the monster is
3905 * target_able and the "interesting" mode is being used.
3907 * The current grid is described using the "look" method above, and
3908 * a new command may be entered at any time, but note that if the
3909 * "TARGET_LOOK" bit flag is set (or if we are in "location" mode,
3910 * where "space" has no obvious meaning) then "space" will scan
3911 * through the description of the current grid until done, instead
3912 * of immediately jumping to the next "interesting" grid. This
3913 * allows the "target" command to retain its old semantics.
3915 * The "*", "+", and "-" keys may always be used to jump immediately
3916 * to the next (or previous) interesting grid, in the proper mode.
3918 * The "return" key may always be used to scan through a complete
3919 * grid description (forever).
3921 * This command will cancel any old target, even if used from
3922 * inside the "look" command.
3924 bool target_set(int mode)
3943 get_screen_size(&wid, &hgt);
3949 /* Cancel tracking */
3950 /* health_track(0); */
3953 /* Prepare the "temp" array */
3954 target_set_prepare(mode);
3956 /* Start near the player */
3962 /* Interesting grids */
3969 change_panel_xy(y, x);
3971 if (!(mode & TARGET_LOOK)) prt_path(y, x);
3974 c_ptr = &cave[y][x];
3977 if (target_able(c_ptr->m_idx))
3980 strcpy(info, "q»ß t·è p¼« o¸½ +¼¡ -Á°");
3982 strcpy(info, "q,t,p,o,+,-,<dir>");
3987 /* Dis-allow target */
3991 strcpy(info, "q»ß p¼« o¸½ +¼¡ -Á°");
3993 strcpy(info, "q,p,o,+,-,<dir>");
3998 /* Describe and Prompt */
4000 query = target_set_aux(y, x, mode, info);
4004 /* Cancel tracking */
4005 /* health_track(0); */
4007 /* Assume no "direction" */
4012 if (query == '\r') query = 't';
4030 if (target_able(c_ptr->m_idx))
4032 health_track(c_ptr->m_idx);
4033 target_who = c_ptr->m_idx;
4052 if (!expand_list) done = TRUE;
4062 if (!expand_list) done = TRUE;
4069 /* Recenter the map around the player */
4073 p_ptr->update |= (PU_MONSTERS);
4076 p_ptr->redraw |= (PR_MAP);
4079 p_ptr->window |= (PW_OVERHEAD);
4084 /* Recalculate interesting grids */
4085 target_set_prepare(mode);
4104 /* Extract the action (if any) */
4105 d = get_keymap_dir(query);
4112 /* Hack -- move around */
4115 /* Modified to scroll to monster */
4116 int y2 = panel_row_min;
4117 int x2 = panel_col_min;
4119 /* Find a new monster */
4120 i = target_pick(temp_y[m], temp_x[m], ddy[d], ddx[d]);
4122 /* Request to target past last interesting grid */
4123 while (flag && (i < 0))
4125 /* Note the change */
4126 if (change_panel(ddy[d], ddx[d]))
4131 /* Recalculate interesting grids */
4132 target_set_prepare(mode);
4134 /* Look at interesting grids */
4137 /* Find a new monster */
4138 i = target_pick(v, u, ddy[d], ddx[d]);
4144 /* Nothing interesting */
4150 /* Restore previous position */
4153 panel_bounds_center();
4156 p_ptr->update |= (PU_MONSTERS);
4159 p_ptr->redraw |= (PR_MAP);
4162 p_ptr->window |= (PW_OVERHEAD);
4167 /* Recalculate interesting grids */
4168 target_set_prepare(mode);
4170 /* Look at boring grids */
4177 /* Do not move horizontally if unnecessary */
4178 if (((x < panel_col_min + wid / 2) && (dx > 0)) ||
4179 ((x > panel_col_min + wid / 2) && (dx < 0)))
4184 /* Do not move vertically if unnecessary */
4185 if (((y < panel_row_min + hgt / 2) && (dy > 0)) ||
4186 ((y > panel_row_min + hgt / 2) && (dy < 0)))
4191 /* Apply the motion */
4192 if ((y >= panel_row_min+hgt) || (y < panel_row_min) ||
4193 (x >= panel_col_min+wid) || (x < panel_col_min))
4195 if (change_panel(dy, dx)) target_set_prepare(mode);
4198 /* Slide into legality */
4199 if (x >= cur_wid-1) x = cur_wid - 2;
4200 else if (x <= 0) x = 1;
4202 /* Slide into legality */
4203 if (y >= cur_hgt-1) y = cur_hgt- 2;
4204 else if (y <= 0) y = 1;
4213 /* Arbitrary grids */
4216 bool move_fast = FALSE;
4218 if (!(mode & TARGET_LOOK)) prt_path(y, x);
4221 c_ptr = &cave[y][x];
4223 /* Default prompt */
4225 strcpy(info, "q»ß t·è p¼« m¶á +¼¡ -Á°");
4227 strcpy(info, "q,t,p,m,+,-,<dir>");
4231 /* Describe and Prompt (enable "TARGET_LOOK") */
4232 while (!(query = target_set_aux(y, x, mode | TARGET_LOOK, info)));
4234 /* Cancel tracking */
4235 /* health_track(0); */
4237 /* Assume no direction */
4242 if (query == '\r') query = 't';
4245 /* Analyze the keypress */
4269 /* Recenter the map around the player */
4273 p_ptr->update |= (PU_MONSTERS);
4276 p_ptr->redraw |= (PR_MAP);
4279 p_ptr->window |= (PW_OVERHEAD);
4284 /* Recalculate interesting grids */
4285 target_set_prepare(mode);
4307 /* Pick a nearby monster */
4308 for (i = 0; i < temp_n; i++)
4310 t = distance(y, x, temp_y[i], temp_x[i]);
4320 /* Nothing interesting */
4321 if (bd == 999) flag = FALSE;
4328 /* Extract the action (if any) */
4329 d = get_keymap_dir(query);
4331 /* XTRA HACK MOVEFAST */
4332 if (isupper(query)) move_fast = TRUE;
4339 /* Handle "direction" */
4345 /* XTRA HACK MOVEFAST */
4348 int mag = MIN(wid / 2, hgt / 2);
4358 /* Do not move horizontally if unnecessary */
4359 if (((x < panel_col_min + wid / 2) && (dx > 0)) ||
4360 ((x > panel_col_min + wid / 2) && (dx < 0)))
4365 /* Do not move vertically if unnecessary */
4366 if (((y < panel_row_min + hgt / 2) && (dy > 0)) ||
4367 ((y > panel_row_min + hgt / 2) && (dy < 0)))
4372 /* Apply the motion */
4373 if ((y >= panel_row_min + hgt) || (y < panel_row_min) ||
4374 (x >= panel_col_min + wid) || (x < panel_col_min))
4376 if (change_panel(dy, dx)) target_set_prepare(mode);
4379 /* Slide into legality */
4380 if (x >= cur_wid-1) x = cur_wid - 2;
4381 else if (x <= 0) x = 1;
4383 /* Slide into legality */
4384 if (y >= cur_hgt-1) y = cur_hgt- 2;
4385 else if (y <= 0) y = 1;
4393 /* Clear the top line */
4396 /* Recenter the map around the player */
4400 p_ptr->update |= (PU_MONSTERS);
4403 p_ptr->redraw |= (PR_MAP);
4406 p_ptr->window |= (PW_OVERHEAD);
4411 /* Failure to set target */
4412 if (!target_who) return (FALSE);
4420 * Get an "aiming direction" from the user.
4422 * The "dir" is loaded with 1,2,3,4,6,7,8,9 for "actual direction", and
4423 * "0" for "current target", and "-1" for "entry aborted".
4425 * Note that "Force Target", if set, will pre-empt user interaction,
4426 * if there is a usable target already set.
4428 * Note that confusion over-rides any (explicit?) user choice.
4430 bool get_aim_dir(int *dp)
4441 /* Global direction */
4444 /* Hack -- auto-target if requested */
4445 if (use_old_target && target_okay()) dir = 5;
4447 #ifdef ALLOW_REPEAT /* TNB */
4449 if (repeat_pull(dp))
4454 if (!(*dp == 5 && !target_okay()))
4456 /* return (TRUE); */
4461 #endif /* ALLOW_REPEAT -- TNB */
4463 /* Ask until satisfied */
4466 /* Choose a prompt */
4470 p = "Êý¸þ ('*'¤Ç¥¿¡¼¥²¥Ã¥ÈÁªÂò, ESC¤ÇÃæÃÇ)? ";
4472 p = "Direction ('*' to choose a target, Escape to cancel)? ";
4479 p = "Êý¸þ ('5'¤Ç¥¿¡¼¥²¥Ã¥È¤Ø, '*'¤Ç¥¿¡¼¥²¥Ã¥ÈºÆÁªÂò, ESC¤ÇÃæÃÇ)? ";
4481 p = "Direction ('5' for target, '*' to re-target, Escape to cancel)? ";
4486 /* Get a command (or Cancel) */
4487 if (!get_com(p, &command, TRUE)) break;
4491 if (command == '\r') command = 't';
4494 /* Convert various keys to "standard" keys */
4497 /* Use current target */
4508 /* Set new target */
4513 if (target_set(TARGET_KILL)) dir = 5;
4519 /* Extract the action (if any) */
4520 dir = get_keymap_dir(command);
4526 /* Verify requested targets */
4527 if ((dir == 5) && !target_okay()) dir = 0;
4536 project_length = 0; /* reset to default */
4540 /* Save the direction */
4543 /* Check for confusion */
4544 if (p_ptr->confused)
4547 /* Random direction */
4548 dir = ddd[randint0(8)];
4551 /* Notice confusion */
4552 if (command_dir != dir)
4556 msg_print("¤¢¤Ê¤¿¤Ïº®Í𤷤Ƥ¤¤ë¡£");
4558 msg_print("You are confused.");
4563 /* Save direction */
4566 #ifdef ALLOW_REPEAT /* TNB */
4568 /* repeat_push(dir); */
4569 repeat_push(command_dir);
4571 #endif /* ALLOW_REPEAT -- TNB */
4573 /* A "valid" direction was entered */
4580 * Request a "movement" direction (1,2,3,4,6,7,8,9) from the user,
4581 * and place it into "command_dir", unless we already have one.
4583 * This function should be used for all "repeatable" commands, such as
4584 * run, walk, open, close, bash, disarm, spike, tunnel, etc, as well
4585 * as all commands which must reference a grid adjacent to the player,
4586 * and which may not reference the grid under the player. Note that,
4587 * for example, it is no longer possible to "disarm" or "open" chests
4588 * in the same grid as the player.
4590 * Direction "5" is illegal and will (cleanly) abort the command.
4592 * This function tracks and uses the "global direction", and uses
4593 * that as the "desired direction", to which "confusion" is applied.
4595 bool get_rep_dir(int *dp, bool under)
4603 /* Global direction */
4606 #ifdef ALLOW_REPEAT /* TNB */
4608 if (repeat_pull(dp))
4611 /* return (TRUE); */
4614 #endif /* ALLOW_REPEAT -- TNB */
4618 prompt = _("Êý¸þ ('.'¸µ, ESC¤ÇÃæÃÇ)? ", "Direction ('.' at feet, Escape to cancel)? ");
4622 prompt = _("Êý¸þ (ESC¤ÇÃæÃÇ)? ", "Direction (Escape to cancel)? ");
4625 /* Get a direction */
4630 /* Get a command (or Cancel) */
4631 if (!get_com(prompt, &ch, TRUE)) break;
4634 if ((under) && ((ch == '5') || (ch == '-') || (ch == '.')))
4640 /* Look up the direction */
4641 dir = get_keymap_dir(ch);
4648 /* Prevent weirdness */
4649 if ((dir == 5) && (!under)) dir = 0;
4652 if (!dir) return (FALSE);
4654 /* Save desired direction */
4657 /* Apply "confusion" */
4658 if (p_ptr->confused)
4660 /* Standard confusion */
4661 if (randint0(100) < 75)
4663 /* Random direction */
4664 dir = ddd[randint0(8)];
4667 else if (p_ptr->riding)
4669 monster_type *m_ptr = &m_list[p_ptr->riding];
4670 monster_race *r_ptr = &r_info[m_ptr->r_idx];
4672 if (MON_CONFUSED(m_ptr))
4674 /* Standard confusion */
4675 if (randint0(100) < 75)
4677 /* Random direction */
4678 dir = ddd[randint0(8)];
4681 else if ((r_ptr->flags1 & RF1_RAND_50) && (r_ptr->flags1 & RF1_RAND_25) && (randint0(100) < 50))
4683 /* Random direction */
4684 dir = ddd[randint0(8)];
4686 else if ((r_ptr->flags1 & RF1_RAND_50) && (randint0(100) < 25))
4688 /* Random direction */
4689 dir = ddd[randint0(8)];
4693 /* Notice confusion */
4694 if (command_dir != dir)
4696 if (p_ptr->confused)
4700 msg_print("¤¢¤Ê¤¿¤Ïº®Í𤷤Ƥ¤¤ë¡£");
4702 msg_print("You are confused.");
4708 monster_type *m_ptr = &m_list[p_ptr->riding];
4710 monster_desc(m_name, m_ptr, 0);
4711 if (MON_CONFUSED(m_ptr))
4714 msg_format("%s¤Ïº®Í𤷤Ƥ¤¤ë¡£", m_name);
4716 msg_format("%^s is confusing.", m_name);
4723 msg_format("%s¤Ï»×¤¤Ä̤ê¤ËÆ°¤¤¤Æ¤¯¤ì¤Ê¤¤¡£", m_name);
4725 msg_format("You cannot control %s.", m_name);
4731 /* Save direction */
4734 #ifdef ALLOW_REPEAT /* TNB */
4736 /* repeat_push(dir); */
4737 repeat_push(command_dir);
4739 #endif /* ALLOW_REPEAT -- TNB */
4746 bool get_rep_dir2(int *dp)
4753 /* Global direction */
4756 #ifdef ALLOW_REPEAT /* TNB */
4758 if (repeat_pull(dp))
4761 /* return (TRUE); */
4764 #endif /* ALLOW_REPEAT -- TNB */
4766 /* Get a direction */
4771 /* Get a command (or Cancel) */
4773 if (!get_com("Êý¸þ (ESC¤ÇÃæÃÇ)? ", &ch, TRUE)) break;
4775 if (!get_com("Direction (Escape to cancel)? ", &ch, TRUE)) break;
4779 /* Look up the direction */
4780 dir = get_keymap_dir(ch);
4786 /* Prevent weirdness */
4787 if (dir == 5) dir = 0;
4790 if (!dir) return (FALSE);
4792 /* Save desired direction */
4795 /* Apply "confusion" */
4796 if (p_ptr->confused)
4798 /* Standard confusion */
4799 if (randint0(100) < 75)
4801 /* Random direction */
4802 dir = ddd[randint0(8)];
4806 /* Notice confusion */
4807 if (command_dir != dir)
4811 msg_print("¤¢¤Ê¤¿¤Ïº®Í𤷤Ƥ¤¤ë¡£");
4813 msg_print("You are confused.");
4818 /* Save direction */
4821 #ifdef ALLOW_REPEAT /* TNB */
4823 /* repeat_push(dir); */
4824 repeat_push(command_dir);
4826 #endif /* ALLOW_REPEAT -- TNB */
4832 void gain_level_reward(int chosen_reward)
4836 char wrath_reason[32] = "";
4837 int nasty_chance = 6;
4838 int dummy = 0, dummy2 = 0;
4841 char o_name[MAX_NLEN];
4847 if (multi_rew) return;
4848 else multi_rew = TRUE;
4852 if (p_ptr->lev == 13) nasty_chance = 2;
4853 else if (!(p_ptr->lev % 13)) nasty_chance = 3;
4854 else if (!(p_ptr->lev % 14)) nasty_chance = 12;
4856 if (one_in_(nasty_chance))
4857 type = randint1(20); /* Allow the 'nasty' effects */
4859 type = randint1(15) + 5; /* Or disallow them */
4861 if (type < 1) type = 1;
4862 if (type > 20) type = 20;
4867 sprintf(wrath_reason, "%s¤ÎÅܤê",
4868 chaos_patrons[p_ptr->chaos_patron]);
4870 sprintf(wrath_reason, "the Wrath of %s",
4871 chaos_patrons[p_ptr->chaos_patron]);
4875 effect = chaos_rewards[p_ptr->chaos_patron][type];
4877 if (one_in_(6) && !chosen_reward)
4880 msg_format("%^s¤ÏË«Èþ¤È¤·¤Æ¤¢¤Ê¤¿¤òÆÍÁ³ÊÑ°Û¤µ¤»¤¿¡£",
4881 chaos_patrons[p_ptr->chaos_patron]);
4883 msg_format("%^s rewards you with a mutation!",
4884 chaos_patrons[p_ptr->chaos_patron]);
4887 (void)gain_random_mutation(0);
4889 reward = "ÊÑ°Û¤·¤¿¡£";
4891 reward = "mutation";
4896 switch (chosen_reward ? chosen_reward : effect)
4900 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
4901 chaos_patrons[p_ptr->chaos_patron]);
4903 msg_format("The voice of %s booms out:",
4904 chaos_patrons[p_ptr->chaos_patron]);
4908 msg_print("¡ÖÆò¡¢¿·¤¿¤Ê¤ë»Ñ¤òɬÍפȤ»¤ê¡ª¡×");
4910 msg_print("'Thou needst a new form, mortal!'");
4915 reward = "ÊÑ°Û¤·¤¿¡£";
4917 reward = "polymorphing";
4922 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
4923 chaos_patrons[p_ptr->chaos_patron]);
4925 msg_format("The voice of %s booms out:",
4926 chaos_patrons[p_ptr->chaos_patron]);
4930 msg_print("¡ÖÆò¤ÏÎɤ¯¹Ô¤¤¤¿¤ê¡ªÂ³¤±¤è¡ª¡×");
4932 msg_print("'Well done, mortal! Lead on!'");
4935 if (p_ptr->prace == RACE_ANDROID)
4938 msg_print("¤·¤«¤·²¿¤âµ¯¤³¤é¤Ê¤«¤Ã¤¿¡£");
4940 msg_print("But, nothing happen.");
4943 else if (p_ptr->exp < PY_MAX_EXP)
4945 s32b ee = (p_ptr->exp / 2) + 10;
4946 if (ee > 100000L) ee = 100000L;
4948 msg_print("¹¹¤Ë·Ð¸³¤òÀѤó¤À¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£");
4950 msg_print("You feel more experienced.");
4955 reward = "·Ð¸³ÃͤòÆÀ¤¿";
4957 reward = "experience";
4963 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
4964 chaos_patrons[p_ptr->chaos_patron]);
4966 msg_format("The voice of %s booms out:",
4967 chaos_patrons[p_ptr->chaos_patron]);
4971 msg_print("¡Ö²¼Ëͤ衢Æò¤½¤ì¤ËÃͤ»¤º¡£¡×");
4973 msg_print("'Thou didst not deserve that, slave.'");
4976 if (p_ptr->prace == RACE_ANDROID)
4979 msg_print("¤·¤«¤·²¿¤âµ¯¤³¤é¤Ê¤«¤Ã¤¿¡£");
4981 msg_print("But, nothing happen.");
4986 lose_exp(p_ptr->exp / 6);
4988 reward = "·Ð¸³Ãͤò¼º¤Ã¤¿¡£";
4990 reward = "losing experience";
4996 msg_format("%s¤ÎÀ¼¤¬¤µ¤µ¤ä¤¤¤¿:",
4997 chaos_patrons[p_ptr->chaos_patron]);
4999 msg_format("The voice of %s whispers:",
5000 chaos_patrons[p_ptr->chaos_patron]);
5004 msg_print("¡Ö²æ¤¬Í¿¤¨¤·Êª¤ò¸ÌÀ¤Ë»È¤¦¤Ù¤·¡£¡×");
5006 msg_print("'Use my gift wisely.'");
5009 acquirement(py, px, 1, FALSE, FALSE, FALSE);
5011 reward = "¾å¼Á¤Ê¥¢¥¤¥Æ¥à¤ò¼ê¤ËÆþ¤ì¤¿¡£";
5013 reward = "a good item";
5018 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5019 chaos_patrons[p_ptr->chaos_patron]);
5021 msg_format("The voice of %s booms out:",
5022 chaos_patrons[p_ptr->chaos_patron]);
5026 msg_print("¡Ö²æ¤¬Í¿¤¨¤·Êª¤ò¸ÌÀ¤Ë»È¤¦¤Ù¤·¡£¡×");
5028 msg_print("'Use my gift wisely.'");
5031 acquirement(py, px, 1, TRUE, FALSE, FALSE);
5033 reward = "¹âµéÉʤΥ¢¥¤¥Æ¥à¤ò¼ê¤ËÆþ¤ì¤¿¡£";
5035 reward = "an excellent item";
5040 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5041 chaos_patrons[p_ptr->chaos_patron]);
5043 msg_format("The voice of %s booms out:",
5044 chaos_patrons[p_ptr->chaos_patron]);
5048 msg_print("¡ÖÆò¤Î¹Ô¤¤¤Ïµ®¤·õ¤ËÃͤ»¤ê¡£¡×");
5050 msg_print("'Thy deed hath earned thee a worthy blade.'");
5053 /* Get local object */
5056 switch (randint1(p_ptr->lev))
5062 dummy2 = SV_MAIN_GAUCHE;
5071 dummy2 = SV_SMALL_SWORD;
5074 dummy2 = SV_BASILLARD;
5076 case 11: case 12: case 13:
5077 dummy2 = SV_SHORT_SWORD;
5083 dummy2 = SV_CUTLASS;
5086 dummy2 = SV_WAKIZASHI;
5089 dummy2 = SV_KHOPESH;
5095 dummy2 = SV_BROAD_SWORD;
5098 dummy2 = SV_LONG_SWORD;
5101 dummy2 = SV_SCIMITAR;
5104 dummy2 = SV_NINJATO;
5110 dummy2 = SV_BASTARD_SWORD;
5113 dummy2 = SV_GREAT_SCIMITAR;
5116 dummy2 = SV_CLAYMORE;
5119 dummy2 = SV_ESPADON;
5122 dummy2 = SV_TWO_HANDED_SWORD;
5125 dummy2 = SV_FLAMBERGE;
5128 dummy2 = SV_NO_DACHI;
5131 dummy2 = SV_EXECUTIONERS_SWORD;
5134 dummy2 = SV_ZWEIHANDER;
5137 dummy2 = SV_HAYABUSA;
5140 dummy2 = SV_BLADE_OF_CHAOS;
5143 object_prep(q_ptr, lookup_kind(dummy, dummy2));
5144 q_ptr->to_h = 3 + randint1(dun_level) % 10;
5145 q_ptr->to_d = 3 + randint1(dun_level) % 10;
5146 one_resistance(q_ptr);
5147 q_ptr->name2 = EGO_CHAOTIC;
5149 /* Drop it in the dungeon */
5150 (void)drop_near(q_ptr, -1, py, px);
5152 reward = "(º®ÆÙ)¤ÎÉð´ï¤ò¼ê¤ËÆþ¤ì¤¿¡£";
5154 reward = "chaos weapon";
5159 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5160 chaos_patrons[p_ptr->chaos_patron]);
5162 msg_format("The voice of %s booms out:",
5163 chaos_patrons[p_ptr->chaos_patron]);
5167 msg_print("¡ÖÆò¤Î¹Ô¤¤¤Ïµ®¤Ê󤤤ËÃͤ»¤ê¡£¡×");
5169 msg_print("'Thy deed hath earned thee a worthy reward.'");
5172 acquirement(py, px, randint1(2) + 1, FALSE, FALSE, FALSE);
5174 reward = "¾å¼Á¤Ê¥¢¥¤¥Æ¥à¤ò¼ê¤ËÆþ¤ì¤¿¡£";
5176 reward = "good items";
5181 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5182 chaos_patrons[p_ptr->chaos_patron]);
5184 msg_format("The voice of %s booms out:",
5185 chaos_patrons[p_ptr->chaos_patron]);
5189 msg_print("¡Ö²¼Ëͤ衢Æò¤Î¸¥¿È¤Ø¤Î²æ¤¬Àˤ·¤ß̵¤Ê󤤤ò¸«¤ë¤¬¤è¤¤¡£¡×");
5191 msg_print("'Behold, mortal, how generously I reward thy loyalty.'");
5194 acquirement(py, px, randint1(2) + 1, TRUE, FALSE, FALSE);
5196 reward = "¹âµéÉʤΥ¢¥¤¥Æ¥à¤ò¼ê¤ËÆþ¤ì¤¿¡£";
5198 reward = "excellent items";
5203 msg_format("%s¤ÎÀ¼¤¬¹ì¤ÅϤä¿:",
5204 chaos_patrons[p_ptr->chaos_patron]);
5206 msg_format("The voice of %s thunders:",
5207 chaos_patrons[p_ptr->chaos_patron]);
5211 msg_print("¡Ö²¼Ëͤ衢ÆòÐþËý¤Ê¤ê¡£¡×");
5213 msg_print("'Thou art growing arrogant, mortal.'");
5216 (void)activate_ty_curse(FALSE, &count);
5218 reward = "²Ò¡¹¤·¤¤¼ö¤¤¤ò¤«¤±¤é¤ì¤¿¡£";
5225 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5226 chaos_patrons[p_ptr->chaos_patron]);
5228 msg_format("The voice of %s booms out:",
5229 chaos_patrons[p_ptr->chaos_patron]);
5233 msg_print("¡Ö²æ¤¬²¼Ëͤ¿¤Á¤è¡¢¤«¤ÎÐþËý¤Ê¤ë¼Ô¤òÅݤ¹¤Ù¤·¡ª¡×");
5235 msg_print("'My pets, destroy the arrogant mortal!'");
5238 for (dummy = 0; dummy < randint1(5) + 1; dummy++)
5240 (void)summon_specific(0, py, px, dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
5243 reward = "¥â¥ó¥¹¥¿¡¼¤ò¾¤´¤µ¤ì¤¿¡£";
5245 reward = "summoning hostile monsters";
5250 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5251 chaos_patrons[p_ptr->chaos_patron]);
5253 msg_format("The voice of %s booms out:",
5254 chaos_patrons[p_ptr->chaos_patron]);
5258 msg_print("¡ÖÆò¡¢¤è¤ê¶¯¤Å¨¤òɬÍפȤ»¤ê¡ª¡×");
5260 msg_print("'Thou needst worthier opponents!'");
5263 activate_hi_summon(py, px, FALSE);
5265 reward = "¥â¥ó¥¹¥¿¡¼¤ò¾¤´¤µ¤ì¤¿¡£";
5267 reward = "summoning many hostile monsters";
5272 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5273 chaos_patrons[p_ptr->chaos_patron]);
5275 msg_format("The voice of %s booms out:",
5276 chaos_patrons[p_ptr->chaos_patron]);
5280 msg_print("¡Ö»à¤ÈÇ˲õ¤³¤½²æ¤¬´î¤Ó¤Ê¤ê¡ª¡×");
5282 msg_print("'Death and destruction! This pleaseth me!'");
5287 reward = "¥«¥ª¥¹¤ÎÎϤ¬±²´¬¤¤¤¿¡£";
5289 reward = "calling chaos";
5294 msg_format("%s¤ÎÀ¼¤¬ÌĤê¶Á¤¤¤¿:",
5295 chaos_patrons[p_ptr->chaos_patron]);
5297 msg_format("The voice of %s rings out:",
5298 chaos_patrons[p_ptr->chaos_patron]);
5302 msg_print("¡Öα¤Þ¤ë¤Î¤À¡¢²¼Ëͤ衣;¤¬Æò¤ÎÆùÂΤòÃ䨤󡣡×");
5304 msg_print("'Stay, mortal, and let me mold thee.'");
5307 if (one_in_(3) && !(chaos_stats[p_ptr->chaos_patron] < 0))
5308 do_inc_stat(chaos_stats[p_ptr->chaos_patron]);
5310 do_inc_stat(randint0(6));
5312 reward = "ǽÎÏÃͤ¬¾å¤¬¤Ã¤¿¡£";
5314 reward = "increasing a stat";
5319 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5320 chaos_patrons[p_ptr->chaos_patron]);
5322 msg_format("The voice of %s booms out:",
5323 chaos_patrons[p_ptr->chaos_patron]);
5327 msg_print("¡Ö²¼Ëͤ衢;¤ÏÆò¤ËË°¤ß¤¿¤ê¡£¡×");
5329 msg_print("'I grow tired of thee, mortal.'");
5332 if (one_in_(3) && !(chaos_stats[p_ptr->chaos_patron] < 0))
5333 do_dec_stat(chaos_stats[p_ptr->chaos_patron]);
5335 (void)do_dec_stat(randint0(6));
5337 reward = "ǽÎÏÃͤ¬²¼¤¬¤Ã¤¿¡£";
5339 reward = "decreasing a stat";
5344 msg_format("%s¤ÎÀ¼¤¬¹ì¤ÅϤä¿:",
5345 chaos_patrons[p_ptr->chaos_patron]);
5347 msg_format("The voice of %s thunders:",
5348 chaos_patrons[p_ptr->chaos_patron]);
5352 msg_print("¡ÖÆò¡¢¸¬µõ¤¿¤ë¤³¤È¤ò³Ø¤Ö¤Ù¤·¡ª¡×");
5353 msg_print("¤¢¤Ê¤¿¤Ï°ÊÁ°¤è¤ê¼å¤¯¤Ê¤Ã¤¿¡ª");
5355 msg_print("'Thou needst a lesson in humility, mortal!'");
5356 msg_print("You feel less powerful!");
5359 for (dummy = 0; dummy < 6; dummy++)
5361 (void)dec_stat(dummy, 10 + randint1(15), TRUE);
5364 reward = "Á´Ç½ÎÏÃͤ¬²¼¤¬¤Ã¤¿¡£";
5366 reward = "decreasing all stats";
5371 msg_format("%s¤ÎÎϤ¬¿¨¤ì¤ë¤Î¤ò´¶¤¸¤¿¡£",
5373 msg_format("You feel the power of %s touch you.",
5376 chaos_patrons[p_ptr->chaos_patron]);
5379 reward = "½ý¤¬ÊѲ½¤·¤¿¡£";
5381 reward = "polymorphing wounds";
5386 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5387 chaos_patrons[p_ptr->chaos_patron]);
5389 msg_format("The voice of %s booms out:",
5390 chaos_patrons[p_ptr->chaos_patron]);
5394 msg_print("¡Ö²æ¤¬¤µ¤µ¤ä¤«¤Ê¤ë»òʪ¤ò¼õ¤±¤È¤ë¤¬¤è¤¤¡ª¡×");
5396 msg_print("'Receive this modest gift from me!'");
5399 for (dummy = 0; dummy < 6; dummy++)
5401 (void)do_inc_stat(dummy);
5404 reward = "Á´Ç½ÎÏÃͤ¬¾å¤¬¤Ã¤¿¡£";
5406 reward = "increasing all stats";
5411 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5412 chaos_patrons[p_ptr->chaos_patron]);
5414 msg_format("The voice of %s booms out:",
5415 chaos_patrons[p_ptr->chaos_patron]);
5419 msg_print("¡Ö¶ì¤·¤à¤¬¤è¤¤¡¢ÌµÇ½¤Ê¶ò¤«¼Ô¤è¡ª¡×");
5421 msg_print("'Suffer, pathetic fool!'");
5424 fire_ball(GF_DISINTEGRATE, 0, p_ptr->lev * 4, 4);
5425 take_hit(DAMAGE_NOESCAPE, p_ptr->lev * 4, wrath_reason, -1);
5427 reward = "ʬ²ò¤Îµå¤¬È¯À¸¤·¤¿¡£";
5429 reward = "generating disintegration ball";
5434 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5435 chaos_patrons[p_ptr->chaos_patron]);
5437 msg_format("The voice of %s booms out:",
5438 chaos_patrons[p_ptr->chaos_patron]);
5442 msg_print("¡Öᴤ뤬¤è¤¤¡¢²æ¤¬²¼Ëͤ衪¡×");
5444 msg_print("'Rise, my servant!'");
5448 (void)set_poisoned(0);
5450 (void)set_confused(0);
5455 for (dummy = 0; dummy < 6; dummy++)
5457 (void)do_res_stat(dummy);
5460 reward = "ÂÎÎϤ¬²óÉü¤·¤¿¡£";
5466 if (!buki_motteruka(INVEN_RARM) && !buki_motteruka(INVEN_LARM)) break;
5468 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5469 chaos_patrons[p_ptr->chaos_patron]);
5471 msg_format("The voice of %s booms out:",
5472 chaos_patrons[p_ptr->chaos_patron]);
5476 msg_print("¡ÖÆò¡¢Éð´ï¤ËÍê¤ë¤³¤È¤Ê¤«¤ì¡£¡×");
5478 msg_print("'Thou reliest too much on thy weapon.'");
5482 if (buki_motteruka(INVEN_LARM))
5485 if (buki_motteruka(INVEN_RARM) && one_in_(2)) dummy = INVEN_RARM;
5487 object_desc(o_name, &inventory[dummy], OD_NAME_ONLY);
5488 (void)curse_weapon(FALSE, dummy);
5490 reward = format("%s¤¬Ç˲õ¤µ¤ì¤¿¡£", o_name);
5492 reward = format("destroying %s", o_name);
5496 if (!inventory[INVEN_BODY].k_idx) break;
5498 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5499 chaos_patrons[p_ptr->chaos_patron]);
5501 msg_format("The voice of %s booms out:",
5502 chaos_patrons[p_ptr->chaos_patron]);
5506 msg_print("¡ÖÆò¡¢Ëɶñ¤ËÍê¤ë¤³¤È¤Ê¤«¤ì¡£¡×");
5508 msg_print("'Thou reliest too much on thine equipment.'");
5511 object_desc(o_name, &inventory[INVEN_BODY], OD_NAME_ONLY);
5512 (void)curse_armor();
5514 reward = format("%s¤¬Ç˲õ¤µ¤ì¤¿¡£", o_name);
5516 reward = format("destroying %s", o_name);
5521 msg_format("%s¤ÎÀ¼¤¬¤µ¤µ¤ä¤¤¤¿:",
5522 chaos_patrons[p_ptr->chaos_patron]);
5524 msg_format("The voice of %s whispers:",
5525 chaos_patrons[p_ptr->chaos_patron]);
5529 msg_print("¡Ö²æ¤òÅܤꤷ¤á¤¿ºá¤ò½þ¤¦¤Ù¤·¡£¡×");
5531 msg_print("'Now thou shalt pay for annoying me.'");
5534 switch (randint1(4))
5537 (void)activate_ty_curse(FALSE, &count);
5539 reward = "²Ò¡¹¤·¤¤¼ö¤¤¤ò¤«¤±¤é¤ì¤¿¡£";
5545 activate_hi_summon(py, px, FALSE);
5547 reward = "¥â¥ó¥¹¥¿¡¼¤ò¾¤´¤µ¤ì¤¿¡£";
5549 reward = "summoning hostile monsters";
5555 if (!buki_motteruka(INVEN_RARM) && !buki_motteruka(INVEN_LARM)) break;
5557 if (buki_motteruka(INVEN_LARM))
5560 if (buki_motteruka(INVEN_RARM) && one_in_(2)) dummy = INVEN_RARM;
5562 object_desc(o_name, &inventory[dummy], OD_NAME_ONLY);
5563 (void)curse_weapon(FALSE, dummy);
5565 reward = format("%s¤¬Ç˲õ¤µ¤ì¤¿¡£", o_name);
5567 reward = format("destroying %s", o_name);
5572 if (!inventory[INVEN_BODY].k_idx) break;
5573 object_desc(o_name, &inventory[INVEN_BODY], OD_NAME_ONLY);
5574 (void)curse_armor();
5576 reward = format("%s¤¬Ç˲õ¤µ¤ì¤¿¡£", o_name);
5578 reward = format("destroying %s", o_name);
5583 for (dummy = 0; dummy < 6; dummy++)
5585 (void)dec_stat(dummy, 10 + randint1(15), TRUE);
5588 reward = "Á´Ç½ÎÏÃͤ¬²¼¤¬¤Ã¤¿¡£";
5590 reward = "decreasing all stats";
5597 msg_format("%s¤ÎÀ¼¤¬¹ì¤ÅϤä¿:",
5599 msg_format("The voice of %s thunders:",
5602 chaos_patrons[p_ptr->chaos_patron]);
5604 msg_print("¡Ö»à¤Ì¤¬¤è¤¤¡¢²¼Ëͤ衪¡×");
5606 msg_print("'Die, mortal!'");
5609 take_hit(DAMAGE_LOSELIFE, p_ptr->lev * 4, wrath_reason, -1);
5610 for (dummy = 0; dummy < 6; dummy++)
5612 (void)dec_stat(dummy, 10 + randint1(15), FALSE);
5614 activate_hi_summon(py, px, FALSE);
5615 (void)activate_ty_curse(FALSE, &count);
5620 if (buki_motteruka(INVEN_RARM))
5623 if (buki_motteruka(INVEN_LARM) && one_in_(2)) dummy = INVEN_LARM;
5625 else if (buki_motteruka(INVEN_LARM)) dummy = INVEN_LARM;
5627 if (dummy) (void)curse_weapon(FALSE, dummy);
5629 if (one_in_(2)) (void)curse_armor();
5633 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5634 chaos_patrons[p_ptr->chaos_patron]);
5636 msg_format("The voice of %s booms out:",
5637 chaos_patrons[p_ptr->chaos_patron]);
5641 msg_print("¡Ö»à¤ÈÇ˲õ¤³¤½²æ¤¬´î¤Ó¤Ê¤ê¡ª¡×");
5643 msg_print("'Death and destruction! This pleaseth me!'");
5646 (void)destroy_area(py, px, 25, FALSE);
5648 reward = "¥À¥ó¥¸¥ç¥ó¤¬*Ç˲õ*¤µ¤ì¤¿¡£";
5650 reward = "*destruct*ing dungeon";
5655 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5656 chaos_patrons[p_ptr->chaos_patron]);
5658 msg_format("The voice of %s booms out:",
5659 chaos_patrons[p_ptr->chaos_patron]);
5663 msg_print("¡Ö²æ¡¢Æò¤ÎŨ¤òËõ»¦¤»¤ó¡ª¡×");
5665 msg_print("'Let me relieve thee of thine oppressors!'");
5668 (void)symbol_genocide(0, FALSE);
5670 reward = "¥â¥ó¥¹¥¿¡¼¤¬Ëõ»¦¤µ¤ì¤¿¡£";
5672 reward = "genociding monsters";
5677 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5678 chaos_patrons[p_ptr->chaos_patron]);
5680 msg_format("The voice of %s booms out:",
5681 chaos_patrons[p_ptr->chaos_patron]);
5685 msg_print("¡Ö²æ¡¢Æò¤ÎŨ¤òËõ»¦¤»¤ó¡ª¡×");
5687 msg_print("'Let me relieve thee of thine oppressors!'");
5690 (void)mass_genocide(0, FALSE);
5692 reward = "¥â¥ó¥¹¥¿¡¼¤¬Ëõ»¦¤µ¤ì¤¿¡£";
5694 reward = "genociding nearby monsters";
5699 msg_format("%s¤ÎÎϤ¬Å¨¤ò¹¶·â¤¹¤ë¤Î¤ò´¶¤¸¤¿¡ª",
5700 chaos_patrons[p_ptr->chaos_patron]);
5702 msg_format("You can feel the power of %s assault your enemies!",
5703 chaos_patrons[p_ptr->chaos_patron]);
5706 (void)dispel_monsters(p_ptr->lev * 4);
5710 msg_format("%s¤Ï¤¢¤Ê¤¿¤ò̵»ë¤·¤¿¡£",
5711 chaos_patrons[p_ptr->chaos_patron]);
5713 msg_format("%s ignores you.",
5714 chaos_patrons[p_ptr->chaos_patron]);
5720 msg_format("%s¤ÏË«Èþ¤È¤·¤Æ°Ëâ¤Î»È¤¤¤ò¤è¤³¤·¤¿¡ª",chaos_patrons[p_ptr->chaos_patron]);
5722 msg_format("%s rewards you with a demonic servant!",chaos_patrons[p_ptr->chaos_patron]);
5725 if (!summon_specific(-1, py, px, dun_level, SUMMON_DEMON, PM_FORCE_PET))
5727 msg_print("²¿¤â¸½¤ì¤Ê¤«¤Ã¤¿...");
5729 msg_print("Nobody ever turns up...");
5733 reward = "°Ë⤬¥Ú¥Ã¥È¤Ë¤Ê¤Ã¤¿¡£";
5735 reward = "a demonic servant";
5741 msg_format("%s¤ÏË«Èþ¤È¤·¤Æ»È¤¤¤ò¤è¤³¤·¤¿¡ª",chaos_patrons[p_ptr->chaos_patron]);
5743 msg_format("%s rewards you with a servant!",chaos_patrons[p_ptr->chaos_patron]);
5746 if (!summon_specific(-1, py, px, dun_level, 0, PM_FORCE_PET))
5748 msg_print("²¿¤â¸½¤ì¤Ê¤«¤Ã¤¿...");
5750 msg_print("Nobody ever turns up...");
5754 reward = "¥â¥ó¥¹¥¿¡¼¤¬¥Ú¥Ã¥È¤Ë¤Ê¤Ã¤¿¡£";
5756 reward = "a servant";
5762 msg_format("%s¤ÏË«Èþ¤È¤·¤Æ¥¢¥ó¥Ç¥Ã¥É¤Î»È¤¤¤ò¤è¤³¤·¤¿¡£",chaos_patrons[p_ptr->chaos_patron]);
5764 msg_format("%s rewards you with an undead servant!",chaos_patrons[p_ptr->chaos_patron]);
5767 if (!summon_specific(-1, py, px, dun_level, SUMMON_UNDEAD, PM_FORCE_PET))
5769 msg_print("²¿¤â¸½¤ì¤Ê¤«¤Ã¤¿...");
5771 msg_print("Nobody ever turns up...");
5775 reward = "¥¢¥ó¥Ç¥Ã¥É¤¬¥Ú¥Ã¥È¤Ë¤Ê¤Ã¤¿¡£";
5777 reward = "an undead servant";
5783 msg_format("%s¤ÎÀ¼¤¬¤É¤â¤Ã¤¿:",
5785 msg_format("The voice of %s stammers:",
5788 chaos_patrons[p_ptr->chaos_patron]);
5790 msg_format("¡Ö¤¢¡¼¡¢¤¢¡¼¡¢Åú¤¨¤Ï %d/%d¡£¼ÁÌä¤Ï²¿¡©¡×", type, effect);
5792 msg_format("'Uh... uh... the answer's %d/%d, what's the question?'", type, effect);
5800 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, format("¥Ñ¥È¥í¥ó¤ÎÊó½·¤Ç%s", reward));
5802 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, format("The patron rewards you with %s.", reward));
5809 * XAngband: determine if a given location is "interesting"
5810 * based on target_set_accept function.
5812 static bool tgt_pt_accept(int y, int x)
5817 if (!(in_bounds(y, x))) return (FALSE);
5819 /* Player grid is always interesting */
5820 if ((y == py) && (x == px)) return (TRUE);
5822 /* Handle hallucination */
5823 if (p_ptr->image) return (FALSE);
5825 /* Examine the grid */
5826 c_ptr = &cave[y][x];
5828 /* Interesting memorized features */
5829 if (c_ptr->info & (CAVE_MARK))
5832 if (cave_have_flag_grid(c_ptr, FF_LESS)) return (TRUE);
5833 if (cave_have_flag_grid(c_ptr, FF_MORE)) return (TRUE);
5835 /* Notice quest features */
5836 if (cave_have_flag_grid(c_ptr, FF_QUEST_ENTER)) return (TRUE);
5837 if (cave_have_flag_grid(c_ptr, FF_QUEST_EXIT)) return (TRUE);
5846 * XAngband: Prepare the "temp" array for "tget_pt"
5847 * based on target_set_prepare funciton.
5849 static void tgt_pt_prepare(void)
5853 /* Reset "temp" array */
5856 if (!expand_list) return;
5858 /* Scan the current panel */
5859 for (y = 1; y < cur_hgt; y++)
5861 for (x = 1; x < cur_wid; x++)
5863 /* Require "interesting" contents */
5864 if (!tgt_pt_accept(y, x)) continue;
5866 /* Save the location */
5873 /* Target the nearest monster for shooting */
5874 ang_sort_comp = ang_sort_comp_distance;
5875 ang_sort_swap = ang_sort_swap_distance;
5877 /* Sort the positions */
5878 ang_sort(temp_x, temp_y, temp_n);
5882 * old -- from PsiAngband.
5884 bool tgt_pt(int *x_ptr, int *y_ptr)
5888 bool success = FALSE;
5893 get_screen_size(&wid, &hgt);
5905 msg_print("¾ì½ê¤òÁª¤ó¤Ç¥¹¥Ú¡¼¥¹¥¡¼¤ò²¡¤·¤Æ²¼¤µ¤¤¡£");
5907 msg_print("Select a point and press space.");
5909 msg_flag = FALSE; /* prevents "-more-" message. */
5911 while ((ch != ESCAPE) && !success)
5913 bool move_fast = FALSE;
5915 move_cursor_relative(y, x);
5927 if (player_bold(y, x)) ch = 0;
5930 else success = TRUE;
5934 /* XAngband: Move cursor to stairs */
5937 if (expand_list && temp_n)
5940 int cx = (panel_col_min + panel_col_max) / 2;
5941 int cy = (panel_row_min + panel_row_max) / 2;
5945 /* Skip stairs which have defferent distance */
5946 for (; n < temp_n; ++ n)
5948 cave_type *c_ptr = &cave[temp_y[n]][temp_x[n]];
5950 if (cave_have_flag_grid(c_ptr, FF_STAIRS) &&
5951 cave_have_flag_grid(c_ptr, ch == '>' ? FF_MORE : FF_LESS))
5958 if (n == temp_n) /* Loop out taget list */
5963 verify_panel(); /* Move cursor to player */
5966 p_ptr->update |= (PU_MONSTERS);
5969 p_ptr->redraw |= (PR_MAP);
5972 p_ptr->window |= (PW_OVERHEAD);
5977 else /* move cursor to next stair and change panel */
5982 dy = 2 * (y - cy) / hgt;
5983 dx = 2 * (x - cx) / wid;
5984 if (dy || dx) change_panel(dy, dx);
5990 /* Look up the direction */
5991 d = get_keymap_dir(ch);
5993 /* XTRA HACK MOVEFAST */
5994 if (isupper(ch)) move_fast = TRUE;
5996 /* Handle "direction" */
6002 /* XTRA HACK MOVEFAST */
6005 int mag = MIN(wid / 2, hgt / 2);
6015 /* Do not move horizontally if unnecessary */
6016 if (((x < panel_col_min + wid / 2) && (dx > 0)) ||
6017 ((x > panel_col_min + wid / 2) && (dx < 0)))
6022 /* Do not move vertically if unnecessary */
6023 if (((y < panel_row_min + hgt / 2) && (dy > 0)) ||
6024 ((y > panel_row_min + hgt / 2) && (dy < 0)))
6029 /* Apply the motion */
6030 if ((y >= panel_row_min + hgt) || (y < panel_row_min) ||
6031 (x >= panel_col_min + wid) || (x < panel_col_min))
6033 /* if (change_panel(dy, dx)) target_set_prepare(mode); */
6034 change_panel(dy, dx);
6037 /* Slide into legality */
6038 if (x >= cur_wid-1) x = cur_wid - 2;
6039 else if (x <= 0) x = 1;
6041 /* Slide into legality */
6042 if (y >= cur_hgt-1) y = cur_hgt- 2;
6043 else if (y <= 0) y = 1;
6050 /* Clear the top line */
6053 /* Recenter the map around the player */
6057 p_ptr->update |= (PU_MONSTERS);
6060 p_ptr->redraw |= (PR_MAP);
6063 p_ptr->window |= (PW_OVERHEAD);
6074 bool get_hack_dir(int *dp)
6084 /* Global direction */
6087 /* (No auto-targeting) */
6089 /* Ask until satisfied */
6092 /* Choose a prompt */
6096 p = "Êý¸þ ('*'¤Ç¥¿¡¼¥²¥Ã¥ÈÁªÂò, ESC¤ÇÃæÃÇ)? ";
6098 p = "Direction ('*' to choose a target, Escape to cancel)? ";
6105 p = "Êý¸þ ('5'¤Ç¥¿¡¼¥²¥Ã¥È¤Ø, '*'¤Ç¥¿¡¼¥²¥Ã¥ÈºÆÁªÂò, ESC¤ÇÃæÃÇ)? ";
6107 p = "Direction ('5' for target, '*' to re-target, Escape to cancel)? ";
6112 /* Get a command (or Cancel) */
6113 if (!get_com(p, &command, TRUE)) break;
6117 if (command == '\r') command = 't';
6120 /* Convert various keys to "standard" keys */
6123 /* Use current target */
6134 /* Set new target */
6139 if (target_set(TARGET_KILL)) dir = 5;
6145 /* Look up the direction */
6146 dir = get_keymap_dir(command);
6152 /* Verify requested targets */
6153 if ((dir == 5) && !target_okay()) dir = 0;
6160 if (!dir) return (FALSE);
6162 /* Save the direction */
6165 /* Check for confusion */
6166 if (p_ptr->confused)
6169 /* Random direction */
6170 dir = ddd[randint0(8)];
6173 /* Notice confusion */
6174 if (command_dir != dir)
6178 msg_print("¤¢¤Ê¤¿¤Ïº®Í𤷤Ƥ¤¤ë¡£");
6180 msg_print("You are confused.");
6185 /* Save direction */
6188 /* A "valid" direction was entered */
6194 * ¥¨¥Í¥ë¥®¡¼¤ÎÁý²ÃÎÌ10d5¤ò®¤¯·×»»¤¹¤ë¤¿¤á¤Î´Ø¿ô
6197 #define Go_no_JuuJou 5*5*5*5*5*5*5*5*5*5
6199 s16b gain_energy(void)
6202 s32b energy_result = 10;
6205 tmp = randint0(Go_no_JuuJou);
6207 for (i = 0; i < 9; i ++){
6208 energy_result += tmp % 5;
6212 return (s16b)(energy_result + tmp);
6219 s16b bow_energy(int sval)
6223 /* Analyze the launcher */
6226 /* Sling and ammo */
6233 /* Short Bow and Arrow */
6240 /* Long Bow and Arrow */
6247 /* Bow of irresponsiblity and Arrow */
6254 /* Light Crossbow and Bolt */
6261 /* Heavy Crossbow and Bolt */
6276 int bow_tmul(int sval)
6280 /* Analyze the launcher */
6283 /* Sling and ammo */
6290 /* Short Bow and Arrow */
6297 /* Long Bow and Arrow */
6304 /* Bow of irresponsiblity and Arrow */
6311 /* Light Crossbow and Bolt */
6318 /* Heavy Crossbow and Bolt */
6330 * Return alignment title
6332 cptr your_alignment(void)
6335 if (p_ptr->align > 150) return "ÂçÁ±";
6336 else if (p_ptr->align > 50) return "ÃæÁ±";
6337 else if (p_ptr->align > 10) return "¾®Á±";
6338 else if (p_ptr->align > -11) return "ÃæΩ";
6339 else if (p_ptr->align > -51) return "¾®°";
6340 else if (p_ptr->align > -151) return "Ãæ°";
6343 if (p_ptr->align > 150) return "Lawful";
6344 else if (p_ptr->align > 50) return "Good";
6345 else if (p_ptr->align > 10) return "Neutral Good";
6346 else if (p_ptr->align > -11) return "Neutral";
6347 else if (p_ptr->align > -51) return "Neutral Evil";
6348 else if (p_ptr->align > -151) return "Evil";
6349 else return "Chaotic";
6355 * Return proficiency level of weapons and misc. skills (except riding)
6357 int weapon_exp_level(int weapon_exp)
6359 if (weapon_exp < WEAPON_EXP_BEGINNER) return EXP_LEVEL_UNSKILLED;
6360 else if (weapon_exp < WEAPON_EXP_SKILLED) return EXP_LEVEL_BEGINNER;
6361 else if (weapon_exp < WEAPON_EXP_EXPERT) return EXP_LEVEL_SKILLED;
6362 else if (weapon_exp < WEAPON_EXP_MASTER) return EXP_LEVEL_EXPERT;
6363 else return EXP_LEVEL_MASTER;
6368 * Return proficiency level of riding
6370 int riding_exp_level(int riding_exp)
6372 if (riding_exp < RIDING_EXP_BEGINNER) return EXP_LEVEL_UNSKILLED;
6373 else if (riding_exp < RIDING_EXP_SKILLED) return EXP_LEVEL_BEGINNER;
6374 else if (riding_exp < RIDING_EXP_EXPERT) return EXP_LEVEL_SKILLED;
6375 else if (riding_exp < RIDING_EXP_MASTER) return EXP_LEVEL_EXPERT;
6376 else return EXP_LEVEL_MASTER;
6381 * Return proficiency level of spells
6383 int spell_exp_level(int spell_exp)
6385 if (spell_exp < SPELL_EXP_BEGINNER) return EXP_LEVEL_UNSKILLED;
6386 else if (spell_exp < SPELL_EXP_SKILLED) return EXP_LEVEL_BEGINNER;
6387 else if (spell_exp < SPELL_EXP_EXPERT) return EXP_LEVEL_SKILLED;
6388 else if (spell_exp < SPELL_EXP_MASTER) return EXP_LEVEL_EXPERT;
6389 else return EXP_LEVEL_MASTER;
6394 * Display a rumor and apply its effects
6397 int rumor_num(char *zz, int max_idx)
6399 if (strcmp(zz, "*") == 0) return randint1(max_idx - 1);
6403 cptr rumor_bind_name(char *base, cptr fullname)
6407 s = strstr(base, "{Name}");
6411 v = format("%s%s%s", base, fullname, (s + 6));
6421 void display_rumor(bool ex)
6429 if (randint0(3) == 0) section = 1;
6433 err = get_rnd_line_jonly("rumors_j.txt", section, Rumor, 10);
6434 if (err) strcpy(Rumor, "±³¤Î±½¤â¤¢¤ë¡£");
6436 err = get_rnd_line("rumors.txt", section, Rumor);
6437 if (err) strcpy(Rumor, "Some rumors are wrong.");
6442 if (strncmp(Rumor, "R:", 2) == 0)
6445 cptr rumor_msg = NULL;
6446 cptr rumor_eff_format = NULL;
6447 char fullname[1024] = "";
6449 if (tokenize(Rumor + 2, 3, zz, TOKENIZE_CHECKQUOTE) == 3)
6451 if (strcmp(zz[0], "ARTIFACT") == 0)
6455 object_type *q_ptr = &forge;
6456 artifact_type *a_ptr;
6460 a_idx = rumor_num(zz[1], max_a_idx);
6462 a_ptr = &a_info[a_idx];
6463 if (a_ptr->name) break;
6466 k_idx = lookup_kind(a_ptr->tval, a_ptr->sval);
6467 object_prep(q_ptr, k_idx);
6468 q_ptr->name1 = a_idx;
6469 q_ptr->ident = IDENT_STORE;
6470 object_desc(fullname, q_ptr, OD_NAME_ONLY);
6472 else if (strcmp(zz[0], "MONSTER") == 0)
6475 monster_race *r_ptr;
6479 r_idx = rumor_num(zz[1], max_r_idx);
6480 r_ptr = &r_info[r_idx];
6481 if (r_ptr->name) break;
6484 strcpy(fullname, r_name + r_ptr->name);
6486 /* Remember this monster */
6487 if (!r_ptr->r_sights)
6492 else if (strcmp(zz[0], "DUNGEON") == 0)
6495 dungeon_info_type *d_ptr;
6499 d_idx = rumor_num(zz[1], max_d_idx);
6500 d_ptr = &d_info[d_idx];
6501 if (d_ptr->name) break;
6504 strcpy(fullname, d_name + d_ptr->name);
6506 if (!max_dlv[d_idx])
6508 max_dlv[d_idx] = d_ptr->mindepth;
6509 rumor_eff_format = _("%s¤Ëµ¢´Ô¤Ç¤¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¡£", "You can recall to %s.");
6512 else if (strcmp(zz[0], "TOWN") == 0)
6519 t_idx = rumor_num(zz[1], NO_TOWN);
6520 if (town[t_idx].name) break;
6523 strcpy(fullname, town[t_idx].name);
6525 visit = (1L << (t_idx - 1));
6526 if ((t_idx != SECRET_TOWN) && !(p_ptr->visit & visit))
6528 p_ptr->visit |= visit;
6529 rumor_eff_format = _("%s¤Ë¹Ô¤Ã¤¿¤³¤È¤¬¤¢¤ëµ¤¤¬¤¹¤ë¡£", "You feel you have been to %s.");
6533 rumor_msg = rumor_bind_name(zz[2], fullname);
6534 msg_print(rumor_msg);
6535 if (rumor_eff_format)
6538 msg_format(rumor_eff_format, fullname);
6544 if (err) msg_print("¤³¤Î¾ðÊó¤Ï´Ö°ã¤Ã¤Æ¤¤¤ë¡£");
6546 if (err) msg_print("This information is wrong.");
6551 msg_format("%s", Rumor);