4 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
6 * This software may be copied and distributed for educational, research,
7 * and not for profit purposes provided that this copyright and statement
8 * are included in all such copies. Other copyrights may also apply.
11 /* Purpose: effects of various "objects" */
15 #define REWARD_CHANCE 10
19 * Advance experience levels and print experience
21 void check_experience(void)
23 bool level_reward = FALSE;
24 bool level_mutation = FALSE;
25 bool level_inc_stat = FALSE;
26 bool android = (p_ptr->prace == RACE_ANDROID ? TRUE : FALSE);
27 int old_lev = p_ptr->lev;
29 /* Hack -- lower limit */
30 if (p_ptr->exp < 0) p_ptr->exp = 0;
31 if (p_ptr->max_exp < 0) p_ptr->max_exp = 0;
32 if (p_ptr->max_max_exp < 0) p_ptr->max_max_exp = 0;
34 /* Hack -- upper limit */
35 if (p_ptr->exp > PY_MAX_EXP) p_ptr->exp = PY_MAX_EXP;
36 if (p_ptr->max_exp > PY_MAX_EXP) p_ptr->max_exp = PY_MAX_EXP;
37 if (p_ptr->max_max_exp > PY_MAX_EXP) p_ptr->max_max_exp = PY_MAX_EXP;
39 /* Hack -- maintain "max" experience */
40 if (p_ptr->exp > p_ptr->max_exp) p_ptr->max_exp = p_ptr->exp;
42 /* Hack -- maintain "max max" experience */
43 if (p_ptr->max_exp > p_ptr->max_max_exp) p_ptr->max_max_exp = p_ptr->max_exp;
45 /* Redraw experience */
46 p_ptr->redraw |= (PR_EXP);
52 /* Lose levels while possible */
53 while ((p_ptr->lev > 1) &&
54 (p_ptr->exp < ((android ? player_exp_a : player_exp)[p_ptr->lev - 2] * p_ptr->expfact / 100L)))
59 /* Update some stuff */
60 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
62 /* Redraw some stuff */
63 p_ptr->redraw |= (PR_LEV | PR_TITLE);
66 p_ptr->window |= (PW_PLAYER);
73 /* Gain levels while possible */
74 while ((p_ptr->lev < PY_MAX_LEVEL) &&
75 (p_ptr->exp >= ((android ? player_exp_a : player_exp)[p_ptr->lev-1] * p_ptr->expfact / 100L)))
80 /* Save the highest level */
81 if (p_ptr->lev > p_ptr->max_plv)
83 p_ptr->max_plv = p_ptr->lev;
85 if ((p_ptr->pclass == CLASS_CHAOS_WARRIOR) ||
86 (p_ptr->muta2 & MUT2_CHAOS_GIFT))
90 if (p_ptr->prace == RACE_BEASTMAN)
92 if (one_in_(5)) level_mutation = TRUE;
94 level_inc_stat = TRUE;
96 do_cmd_write_nikki(NIKKI_LEVELUP, p_ptr->lev, NULL);
104 msg_format("¥ì¥Ù¥ë %d ¤Ë¤è¤¦¤³¤½¡£", p_ptr->lev);
106 msg_format("Welcome to level %d.", p_ptr->lev);
110 /* Update some stuff */
111 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
113 /* Redraw some stuff */
114 p_ptr->redraw |= (PR_LEV | PR_TITLE | PR_EXP);
117 p_ptr->window |= (PW_PLAYER | PW_SPELL | PW_INVEN);
119 /* HP¤ÈMP¤Î¾å¾ºÎ̤òɽ¼¨ */
129 if(!(p_ptr->max_plv % 10))
139 cnv_stat(p_ptr->stat_max[0], tmp);
140 prt(format(" a) ÏÓÎÏ (¸½ºßÃÍ %s)", tmp), 2, 14);
141 cnv_stat(p_ptr->stat_max[1], tmp);
142 prt(format(" b) ÃÎǽ (¸½ºßÃÍ %s)", tmp), 3, 14);
143 cnv_stat(p_ptr->stat_max[2], tmp);
144 prt(format(" c) ¸¤µ (¸½ºßÃÍ %s)", tmp), 4, 14);
145 cnv_stat(p_ptr->stat_max[3], tmp);
146 prt(format(" d) ´ïÍÑ (¸½ºßÃÍ %s)", tmp), 5, 14);
147 cnv_stat(p_ptr->stat_max[4], tmp);
148 prt(format(" e) ÂÑµ× (¸½ºßÃÍ %s)", tmp), 6, 14);
149 cnv_stat(p_ptr->stat_max[5], tmp);
150 prt(format(" f) Ì¥ÎÏ (¸½ºßÃÍ %s)", tmp), 7, 14);
152 prt(" ¤É¤ÎǽÎÏÃͤò¾å¤²¤Þ¤¹¤«¡©", 1, 14);
154 cnv_stat(p_ptr->stat_max[0], tmp);
155 prt(format(" a) Str (cur %s)", tmp), 2, 14);
156 cnv_stat(p_ptr->stat_max[1], tmp);
157 prt(format(" b) Int (cur %s)", tmp), 3, 14);
158 cnv_stat(p_ptr->stat_max[2], tmp);
159 prt(format(" c) Wis (cur %s)", tmp), 4, 14);
160 cnv_stat(p_ptr->stat_max[3], tmp);
161 prt(format(" d) Dex (cur %s)", tmp), 5, 14);
162 cnv_stat(p_ptr->stat_max[4], tmp);
163 prt(format(" e) Con (cur %s)", tmp), 6, 14);
164 cnv_stat(p_ptr->stat_max[5], tmp);
165 prt(format(" f) Chr (cur %s)", tmp), 7, 14);
167 prt(" Which stat do you want to raise?", 1, 14);
172 if ((choice >= 'a') && (choice <= 'f')) break;
174 for(n = 0; n < 6; n++)
175 if (n != choice - 'a')
178 if (get_check("¤è¤í¤·¤¤¤Ç¤¹¤«¡©")) break;
180 if (get_check("Are you sure? ")) break;
183 do_inc_stat(choice - 'a');
186 else if(!(p_ptr->max_plv % 2))
187 do_inc_stat(randint0(6));
193 msg_print("¤¢¤Ê¤¿¤ÏÊѤï¤Ã¤¿µ¤¤¬¤¹¤ë...");
195 msg_print("You feel different...");
198 (void)gain_random_mutation(0);
199 level_mutation = FALSE;
203 * Ê󽷤ǥì¥Ù¥ë¤¬¾å¤ë¤ÈºÆµ¢Åª¤Ë check_experience() ¤¬
204 * ¸Æ¤Ð¤ì¤ë¤Î¤Ç½çÈÖ¤òºÇ¸å¤Ë¤¹¤ë¡£
208 gain_level_reward(0);
209 level_reward = FALSE;
212 /* Update some stuff */
213 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
215 /* Redraw some stuff */
216 p_ptr->redraw |= (PR_LEV | PR_TITLE);
219 p_ptr->window |= (PW_PLAYER | PW_SPELL);
225 /* Load an autopick preference file */
226 if (old_lev != p_ptr->lev) autopick_load_pref(FALSE);
231 * Hack -- Return the "automatic coin type" of a monster race
232 * Used to allocate proper treasure when "Creeping coins" die
234 * XXX XXX XXX Note the use of actual "monster names"
236 static int get_coin_type(int r_idx)
238 /* Analyze monsters */
241 case MON_COPPER_COINS: return 2;
242 case MON_SILVER_COINS: return 5;
243 case MON_GOLD_COINS: return 10;
244 case MON_MITHRIL_COINS:
245 case MON_MITHRIL_GOLEM: return 16;
246 case MON_ADAMANT_COINS: return 17;
255 * Hack -- determine if a template is Cloak
257 static bool kind_is_cloak(int k_idx)
259 object_kind *k_ptr = &k_info[k_idx];
261 /* Analyze the item type */
262 if (k_ptr->tval == TV_CLOAK)
267 /* Assume not good */
273 * Hack -- determine if a template is Polearm
275 static bool kind_is_polearm(int k_idx)
277 object_kind *k_ptr = &k_info[k_idx];
279 /* Analyze the item type */
280 if (k_ptr->tval == TV_POLEARM)
285 /* Assume not good */
291 * Hack -- determine if a template is Sword
293 static bool kind_is_sword(int k_idx)
295 object_kind *k_ptr = &k_info[k_idx];
297 /* Analyze the item type */
298 if ((k_ptr->tval == TV_SWORD) && (k_ptr->sval > 2))
303 /* Assume not good */
309 * Hack -- determine if a template is Book
311 static bool kind_is_book(int k_idx)
313 object_kind *k_ptr = &k_info[k_idx];
315 /* Analyze the item type */
316 if ((k_ptr->tval >= TV_LIFE_BOOK) && (k_ptr->tval <= TV_CRUSADE_BOOK))
321 /* Assume not good */
327 * Hack -- determine if a template is Good book
329 static bool kind_is_good_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) && (k_ptr->tval != TV_ARCANE_BOOK) && (k_ptr->sval > 1))
339 /* Assume not good */
345 * Hack -- determine if a template is Armor
347 static bool kind_is_armor(int k_idx)
349 object_kind *k_ptr = &k_info[k_idx];
351 /* Analyze the item type */
352 if (k_ptr->tval == TV_HARD_ARMOR)
357 /* Assume not good */
363 * Hack -- determine if a template is hafted weapon
365 static bool kind_is_hafted(int k_idx)
367 object_kind *k_ptr = &k_info[k_idx];
369 /* Analyze the item type */
370 if (k_ptr->tval == TV_HAFTED)
375 /* Assume not good */
380 void complete_quest(int quest_num)
382 switch (quest[quest_num].type)
384 case QUEST_TYPE_RANDOM:
385 if (record_rand_quest) do_cmd_write_nikki(NIKKI_RAND_QUEST_C, quest_num, NULL);
388 if (record_fix_quest) do_cmd_write_nikki(NIKKI_FIX_QUEST_C, quest_num, NULL);
392 quest[quest_num].status = QUEST_STATUS_COMPLETED;
393 quest[quest_num].complev = (byte)p_ptr->lev;
395 quest[quest_num].comptime = playtime;
397 if (!(quest[quest_num].flags & QUEST_FLAG_SILENT))
399 msg_print(_("¥¯¥¨¥¹¥È¤òãÀ®¤·¤¿¡ª", "You just completed your quest!"));
404 static int count_all_hostile_monsters(void)
409 for (x = 0; x < cur_wid; ++ x)
411 for (y = 0; y < cur_hgt; ++ y)
413 int m_idx = cave[y][x].m_idx;
415 if (m_idx > 0 && is_hostile(&m_list[m_idx]))
426 * Check for "Quest" completion when a quest monster is killed or charmed.
428 void check_quest_completion(monster_type *m_ptr)
430 int i, j, y, x, ny, nx;
434 bool create_stairs = FALSE;
440 /* Get the location */
445 quest_num = p_ptr->inside_quest;
447 /* Search for an active quest on this dungeon level */
450 for (i = max_quests - 1; i > 0; i--)
452 /* Quest is not active */
453 if (quest[i].status != QUEST_STATUS_TAKEN)
456 /* Quest is not a dungeon quest */
457 if (quest[i].flags & QUEST_FLAG_PRESET)
460 /* Quest is not on this level */
461 if ((quest[i].level != dun_level) &&
462 (quest[i].type != QUEST_TYPE_KILL_ANY_LEVEL))
465 /* Not a "kill monster" quest */
466 if ((quest[i].type == QUEST_TYPE_FIND_ARTIFACT) ||
467 (quest[i].type == QUEST_TYPE_FIND_EXIT))
470 /* Interesting quest */
471 if ((quest[i].type == QUEST_TYPE_KILL_NUMBER) ||
472 (quest[i].type == QUEST_TYPE_TOWER) ||
473 (quest[i].type == QUEST_TYPE_KILL_ALL))
476 /* Interesting quest */
477 if (((quest[i].type == QUEST_TYPE_KILL_LEVEL) ||
478 (quest[i].type == QUEST_TYPE_KILL_ANY_LEVEL) ||
479 (quest[i].type == QUEST_TYPE_RANDOM)) &&
480 (quest[i].r_idx == m_ptr->r_idx))
487 /* Handle the current quest */
488 if (quest_num && (quest[quest_num].status == QUEST_STATUS_TAKEN))
493 switch (quest[i].type)
495 case QUEST_TYPE_KILL_NUMBER:
499 if (quest[i].cur_num >= quest[i].num_mon)
503 quest[i].cur_num = 0;
507 case QUEST_TYPE_KILL_ALL:
509 if (!is_hostile(m_ptr)) break;
511 if (count_all_hostile_monsters() == 1)
513 if (quest[i].flags & QUEST_FLAG_SILENT)
515 quest[i].status = QUEST_STATUS_FINISHED;
524 case QUEST_TYPE_KILL_LEVEL:
525 case QUEST_TYPE_RANDOM:
527 /* Only count valid monsters */
528 if (quest[i].r_idx != m_ptr->r_idx)
533 if (quest[i].cur_num >= quest[i].max_num)
537 if (!(quest[i].flags & QUEST_FLAG_PRESET))
539 create_stairs = TRUE;
540 p_ptr->inside_quest = 0;
543 /* Finish the two main quests without rewarding */
544 if ((i == QUEST_OBERON) || (i == QUEST_SERPENT))
546 quest[i].status = QUEST_STATUS_FINISHED;
549 if (quest[i].type == QUEST_TYPE_RANDOM)
552 quest[i].status = QUEST_STATUS_FINISHED;
557 case QUEST_TYPE_KILL_ANY_LEVEL:
560 if (quest[i].cur_num >= quest[i].max_num)
563 quest[i].cur_num = 0;
567 case QUEST_TYPE_TOWER:
569 if (!is_hostile(m_ptr)) break;
571 if (count_all_hostile_monsters() == 1)
573 quest[i].status = QUEST_STATUS_STAGE_COMPLETED;
575 if((quest[QUEST_TOWER1].status == QUEST_STATUS_STAGE_COMPLETED) &&
576 (quest[QUEST_TOWER2].status == QUEST_STATUS_STAGE_COMPLETED) &&
577 (quest[QUEST_TOWER3].status == QUEST_STATUS_STAGE_COMPLETED))
580 complete_quest(QUEST_TOWER1);
588 /* Create a magical staircase */
592 while (cave_perma_bold(y, x) || cave[y][x].o_idx || (cave[y][x].info & CAVE_OBJECT) )
594 /* Pick a location */
595 scatter(&ny, &nx, y, x, 1, 0);
601 /* Explain the staircase */
603 msg_print("ËâË¡¤Î³¬Ãʤ¬¸½¤ì¤¿...");
605 msg_print("A magical staircase appears...");
609 /* Create stairs down */
610 cave_set_feat(y, x, feat_down_stair);
612 /* Remember to update everything */
613 p_ptr->update |= (PU_FLOW);
621 for (j = 0; j < (dun_level / 15)+1; j++)
623 /* Get local object */
626 /* Wipe the object */
629 /* Make a great object */
630 make_object(q_ptr, AM_GOOD | AM_GREAT);
632 /* Drop it in the dungeon */
633 (void)drop_near(q_ptr, -1, y, x);
639 void check_find_art_quest_completion(object_type *o_ptr)
642 /* Check if completed a quest */
643 for (i = 0; i < max_quests; i++)
645 if ((quest[i].type == QUEST_TYPE_FIND_ARTIFACT) &&
646 (quest[i].status == QUEST_STATUS_TAKEN) &&
647 (quest[i].k_idx == o_ptr->name1))
655 * Return monster death string
657 cptr extract_note_dies(monster_race *r_ptr)
659 /* Some monsters get "destroyed" */
660 if (!monster_living(r_ptr))
664 for (i = 0; i < 4; i++)
666 if (r_ptr->blow[i].method == RBM_EXPLODE)
669 return "¤ÏÇúȯ¤·¤ÆÊ´¡¹¤Ë¤Ê¤Ã¤¿¡£";
671 return " explodes into tiny shreds.";
679 return " is destroyed.";
683 /* Assume a default death */
693 * Handle the "death" of a monster.
695 * Disperse treasures centered at the monster location based on the
696 * various flags contained in the monster flags fields.
698 * Check for "Quest" completion when a quest monster is killed.
700 * Note that only the player can induce "monster_death()" on Uniques.
701 * Thus (for now) all Quest monsters should be Uniques.
703 * Note that monsters can now carry objects, and when a monster dies,
704 * it drops all of its objects, which may disappear in crowded rooms.
706 void monster_death(int m_idx, bool drop_item)
715 monster_type *m_ptr = &m_list[m_idx];
717 monster_race *r_ptr = &r_info[m_ptr->r_idx];
719 bool visible = ((m_ptr->ml && !p_ptr->image) || (r_ptr->flags1 & RF1_UNIQUE));
723 bool do_gold = (!(r_ptr->flags1 & RF1_ONLY_ITEM));
724 bool do_item = (!(r_ptr->flags1 & RF1_ONLY_GOLD));
725 bool cloned = (m_ptr->smart & SM_CLONED) ? TRUE : FALSE;
726 int force_coin = get_coin_type(m_ptr->r_idx);
731 bool drop_chosen_item = drop_item && !cloned && !p_ptr->inside_arena
732 && !p_ptr->inside_battle && !is_pet(m_ptr);
734 /* The caster is dead? */
735 if (world_monster && world_monster == m_idx) world_monster = 0;
737 /* Notice changes in view */
738 if (r_ptr->flags7 & (RF7_LITE_MASK | RF7_DARK_MASK))
740 /* Update some things */
741 p_ptr->update |= (PU_MON_LITE);
744 /* Get the location */
748 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
752 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
753 do_cmd_write_nikki(NIKKI_NAMED_PET, 3, m_name);
756 /* Let monsters explode! */
757 for (i = 0; i < 4; i++)
759 if (r_ptr->blow[i].method == RBM_EXPLODE)
761 int flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
762 int typ = mbe_info[r_ptr->blow[i].effect].explode_type;
763 int d_dice = r_ptr->blow[i].d_dice;
764 int d_side = r_ptr->blow[i].d_side;
765 int damage = damroll(d_dice, d_side);
767 project(m_idx, 3, y, x, damage, typ, flg, -1);
772 if (m_ptr->mflag2 & MFLAG2_CHAMELEON)
774 choose_new_monster(m_idx, TRUE, MON_CHAMELEON);
775 r_ptr = &r_info[m_ptr->r_idx];
778 /* Check for quest completion */
779 check_quest_completion(m_ptr);
781 /* Handle the possibility of player vanquishing arena combatant -KMW- */
782 if (p_ptr->inside_arena && !is_pet(m_ptr))
784 p_ptr->exit_bldg = TRUE;
786 if (p_ptr->arena_number > MAX_ARENA_MONS)
789 msg_print("ÁÇÀ²¤é¤·¤¤¡ª·¯¤³¤½¿¿¤Î¾¡Íø¼Ô¤À¡£");
791 msg_print("You are a Genuine Champion!");
797 msg_print("¾¡Íø¡ª¥Á¥ã¥ó¥Ô¥ª¥ó¤Ø¤ÎÆ»¤ò¿Ê¤ó¤Ç¤¤¤ë¡£");
799 msg_print("Victorious! You're on your way to becoming Champion.");
803 if (arena_info[p_ptr->arena_number].tval)
805 /* Get local object */
808 /* Prepare to make a prize */
809 object_prep(q_ptr, lookup_kind(arena_info[p_ptr->arena_number].tval, arena_info[p_ptr->arena_number].sval));
811 apply_magic(q_ptr, object_level, AM_NO_FIXED_ART);
813 /* Drop it in the dungeon */
814 (void)drop_near(q_ptr, -1, y, x);
817 if (p_ptr->arena_number > MAX_ARENA_MONS) p_ptr->arena_number++;
818 p_ptr->arena_number++;
823 /* Extract monster name */
824 monster_desc(m_name, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
826 do_cmd_write_nikki(NIKKI_ARENA, p_ptr->arena_number, m_name);
830 if (m_idx == p_ptr->riding)
832 if (rakuba(-1, FALSE))
835 msg_print("ÃÏÌ̤ËÍî¤È¤µ¤ì¤¿¡£");
837 msg_print("You have fallen from your riding pet.");
842 /* Drop a dead corpse? */
843 if (one_in_(r_ptr->flags1 & RF1_UNIQUE ? 1 : 4) &&
844 (r_ptr->flags9 & (RF9_DROP_CORPSE | RF9_DROP_SKELETON)) &&
845 !(p_ptr->inside_arena || p_ptr->inside_battle || cloned || ((m_ptr->r_idx == today_mon) && is_pet(m_ptr))))
847 /* Assume skeleton */
851 * We cannot drop a skeleton? Note, if we are in this check,
852 * we *know* we can drop at least a corpse or a skeleton
854 if (!(r_ptr->flags9 & RF9_DROP_SKELETON))
856 else if ((r_ptr->flags9 & RF9_DROP_CORPSE) && (r_ptr->flags1 & RF1_UNIQUE))
859 /* Else, a corpse is more likely unless we did a "lot" of damage */
860 else if (r_ptr->flags9 & RF9_DROP_CORPSE)
862 /* Lots of damage in one blow */
863 if ((0 - ((m_ptr->maxhp) / 4)) > m_ptr->hp)
865 if (one_in_(5)) corpse = TRUE;
869 if (!one_in_(5)) corpse = TRUE;
873 /* Get local object */
876 /* Prepare to make an object */
877 object_prep(q_ptr, lookup_kind(TV_CORPSE, (corpse ? SV_CORPSE : SV_SKELETON)));
879 apply_magic(q_ptr, object_level, AM_NO_FIXED_ART);
881 q_ptr->pval = m_ptr->r_idx;
883 /* Drop it in the dungeon */
884 (void)drop_near(q_ptr, -1, y, x);
887 /* Drop objects being carried */
888 monster_drop_carried_objects(m_ptr);
890 if (r_ptr->flags1 & RF1_DROP_GOOD) mo_mode |= AM_GOOD;
891 if (r_ptr->flags1 & RF1_DROP_GREAT) mo_mode |= AM_GREAT;
893 switch (m_ptr->r_idx)
895 case MON_PINK_HORROR:
896 /* Pink horrors are replaced with 2 Blue horrors */
897 if (!(p_ptr->inside_arena || p_ptr->inside_battle))
901 for (i = 0; i < 2; i++)
904 bool pet = is_pet(m_ptr);
907 if (pet) mode |= PM_FORCE_PET;
909 if (summon_specific((pet ? -1 : m_idx), wy, wx, 100, SUMMON_BLUE_HORROR, mode))
911 if (player_can_see_bold(wy, wx))
918 msg_print("¥Ô¥ó¥¯¡¦¥Û¥é¡¼¤ÏʬÎö¤·¤¿¡ª");
920 msg_print("The Pink horror divides!");
925 case MON_BLOODLETTER:
926 /* Bloodletters of Khorne may drop a blade of chaos */
927 if (drop_chosen_item && (randint1(100) < 15))
929 /* Get local object */
932 /* Prepare to make a Blade of Chaos */
933 object_prep(q_ptr, lookup_kind(TV_SWORD, SV_BLADE_OF_CHAOS));
935 apply_magic(q_ptr, object_level, AM_NO_FIXED_ART | mo_mode);
937 /* Drop it in the dungeon */
938 (void)drop_near(q_ptr, -1, y, x);
943 if (drop_chosen_item && (dun_level > 9))
945 /* Get local object */
948 /* Wipe the object */
951 /* Activate restriction */
952 if ((dun_level > 49) && one_in_(5))
953 get_obj_num_hook = kind_is_good_book;
955 get_obj_num_hook = kind_is_book;
958 make_object(q_ptr, mo_mode);
960 /* Drop it in the dungeon */
961 (void)drop_near(q_ptr, -1, y, x);
967 * Mega^3-hack: killing a 'Warrior of the Dawn' is likely to
968 * spawn another in the fallen one's place!
970 if (!p_ptr->inside_arena && !p_ptr->inside_battle)
976 bool pet = is_pet(m_ptr);
980 scatter(&wy, &wx, y, x, 20, 0);
982 while (!(in_bounds(wy, wx) && cave_empty_bold2(wy, wx)) && --attempts);
987 if (pet) mode |= PM_FORCE_PET;
989 if (summon_specific((pet ? -1 : m_idx), wy, wx, 100, SUMMON_DAWN, mode))
991 if (player_can_see_bold(wy, wx))
993 msg_print("¿·¤¿¤ÊÀï»Î¤¬¸½¤ì¤¿¡ª");
995 msg_print("A new warrior steps forth!");
1005 /* One more ultra-hack: An Unmaker goes out with a big bang! */
1007 int flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
1008 (void)project(m_idx, 6, y, x, 100, GF_CHAOS, flg, -1);
1012 case MON_UNICORN_ORD:
1015 /* Reward for "lazy" player */
1016 if (p_ptr->pseikaku == SEIKAKU_NAMAKE)
1019 artifact_type *a_ptr = NULL;
1021 if (!drop_chosen_item) break;
1025 switch (randint0(3))
1028 a_idx = ART_NAMAKE_HAMMER;
1031 a_idx = ART_NAMAKE_BOW;
1034 a_idx = ART_NAMAKE_ARMOR;
1038 a_ptr = &a_info[a_idx];
1040 while (a_ptr->cur_num);
1042 /* Create the artifact */
1043 if (create_named_art(a_idx, y, x))
1047 /* Hack -- Memorize location of artifact in saved floors */
1048 if (character_dungeon) a_ptr->floor_id = p_ptr->floor_id;
1050 else if (!preserve_mode) a_ptr->cur_num = 1;
1055 if (!drop_chosen_item) break;
1057 /* Get local object */
1060 /* Mega-Hack -- Prepare to make "Grond" */
1061 object_prep(q_ptr, lookup_kind(TV_HAFTED, SV_GROND));
1063 /* Mega-Hack -- Mark this item as "Grond" */
1064 q_ptr->name1 = ART_GROND;
1066 /* Mega-Hack -- Actually create "Grond" */
1067 apply_magic(q_ptr, -1, AM_GOOD | AM_GREAT);
1069 /* Drop it in the dungeon */
1070 (void)drop_near(q_ptr, -1, y, x);
1072 /* Get local object */
1075 /* Mega-Hack -- Prepare to make "Chaos" */
1076 object_prep(q_ptr, lookup_kind(TV_CROWN, SV_CHAOS));
1078 /* Mega-Hack -- Mark this item as "Chaos" */
1079 q_ptr->name1 = ART_CHAOS;
1081 /* Mega-Hack -- Actually create "Chaos" */
1082 apply_magic(q_ptr, -1, AM_GOOD | AM_GREAT);
1084 /* Drop it in the dungeon */
1085 (void)drop_near(q_ptr, -1, y, x);
1088 case MON_B_DEATH_SWORD:
1089 if (drop_chosen_item)
1091 /* Get local object */
1094 /* Prepare to make a broken sword */
1095 object_prep(q_ptr, lookup_kind(TV_SWORD, randint1(2)));
1097 /* Drop it in the dungeon */
1098 (void)drop_near(q_ptr, -1, y, x);
1104 if (drop_chosen_item && ((m_ptr->r_idx == MON_A_GOLD) ||
1105 ((m_ptr->r_idx == MON_A_SILVER) && (r_ptr->r_akills % 5 == 0))))
1107 /* Get local object */
1110 /* Prepare to make a Can of Toys */
1111 object_prep(q_ptr, lookup_kind(TV_CHEST, SV_CHEST_KANDUME));
1113 apply_magic(q_ptr, object_level, AM_NO_FIXED_ART);
1115 /* Drop it in the dungeon */
1116 (void)drop_near(q_ptr, -1, y, x);
1122 int flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
1123 (void)project(m_idx, 3, y, x, damroll(20, 10), GF_FIRE, flg, -1);
1128 if (!drop_chosen_item) break;
1130 switch (r_ptr->d_char)
1135 /* Get local object */
1138 /* Wipe the object */
1141 /* Activate restriction */
1142 get_obj_num_hook = kind_is_cloak;
1145 make_object(q_ptr, mo_mode);
1147 /* Drop it in the dungeon */
1148 (void)drop_near(q_ptr, -1, y, x);
1155 /* Get local object */
1158 /* Wipe the object */
1161 /* Activate restriction */
1162 get_obj_num_hook = kind_is_polearm;
1164 /* Make a poleweapon */
1165 make_object(q_ptr, mo_mode);
1167 /* Drop it in the dungeon */
1168 (void)drop_near(q_ptr, -1, y, x);
1175 /* Get local object */
1178 /* Wipe the object */
1181 /* Activate restriction */
1182 get_obj_num_hook = kind_is_armor;
1184 /* Make a hard armor */
1185 make_object(q_ptr, mo_mode);
1187 /* Drop it in the dungeon */
1188 (void)drop_near(q_ptr, -1, y, x);
1195 /* Get local object */
1198 /* Wipe the object */
1201 /* Activate restriction */
1202 get_obj_num_hook = kind_is_hafted;
1204 /* Make a hafted weapon */
1205 make_object(q_ptr, mo_mode);
1207 /* Drop it in the dungeon */
1208 (void)drop_near(q_ptr, -1, y, x);
1213 if (m_ptr->r_idx != MON_STORMBRINGER)
1215 /* Get local object */
1218 /* Wipe the object */
1221 /* Activate restriction */
1222 get_obj_num_hook = kind_is_sword;
1225 make_object(q_ptr, mo_mode);
1227 /* Drop it in the dungeon */
1228 (void)drop_near(q_ptr, -1, y, x);
1235 /* Mega-Hack -- drop fixed items */
1236 if (drop_chosen_item)
1241 switch (m_ptr->r_idx)
1261 case MON_STORMBRINGER:
1262 a_idx = ART_STORMBRINGER;
1267 a_idx = ART_CRIMSON;
1277 a_idx = ART_KUSANAGI;
1307 a_idx = ART_WEREWINDLE;
1315 a_idx = ART_GRAYSWANDIR;
1326 a_idx = ART_TWILIGHT;
1331 a_idx = ART_ELENDIL;
1346 a_idx = ART_DESTINY;
1351 a_idx = ART_ZANTETSU;
1366 a_idx = ART_WINBLOWS;
1370 case MON_LUNGORTHIN:
1375 case MON_JACK_SHADOWS:
1381 a_idx = ART_STONEMASK;
1386 a_idx = ART_SOULCRUSH;
1391 a_idx = ART_EXCALIBUR_J;
1396 a_idx = ART_SHUTEN_DOJI;
1401 a_idx = ART_GOTHMOG;
1410 case MON_ROBIN_HOOD:
1411 a_idx = ART_ROBIN_HOOD;
1416 if ((a_idx > 0) && ((randint0(100) < chance) || p_ptr->wizard))
1418 artifact_type *a_ptr = &a_info[a_idx];
1420 if (!a_ptr->cur_num)
1422 /* Create the artifact */
1423 if (create_named_art(a_idx, y, x))
1427 /* Hack -- Memorize location of artifact in saved floors */
1428 if (character_dungeon) a_ptr->floor_id = p_ptr->floor_id;
1430 else if (!preserve_mode) a_ptr->cur_num = 1;
1434 if ((r_ptr->flags7 & RF7_GUARDIAN) && (d_info[dungeon_type].final_guardian == m_ptr->r_idx))
1436 int k_idx = d_info[dungeon_type].final_object ? d_info[dungeon_type].final_object
1437 : lookup_kind(TV_SCROLL, SV_SCROLL_ACQUIREMENT);
1439 if (d_info[dungeon_type].final_artifact)
1441 int a_idx = d_info[dungeon_type].final_artifact;
1442 artifact_type *a_ptr = &a_info[a_idx];
1444 if (!a_ptr->cur_num)
1446 /* Create the artifact */
1447 if (create_named_art(a_idx, y, x))
1451 /* Hack -- Memorize location of artifact in saved floors */
1452 if (character_dungeon) a_ptr->floor_id = p_ptr->floor_id;
1454 else if (!preserve_mode) a_ptr->cur_num = 1;
1456 /* Prevent rewarding both artifact and "default" object */
1457 if (!d_info[dungeon_type].final_object) k_idx = 0;
1463 /* Get local object */
1466 /* Prepare to make a reward */
1467 object_prep(q_ptr, k_idx);
1469 apply_magic(q_ptr, object_level, AM_NO_FIXED_ART | AM_GOOD);
1471 /* Drop it in the dungeon */
1472 (void)drop_near(q_ptr, -1, y, x);
1475 msg_format("¤¢¤Ê¤¿¤Ï%s¤òÀ©ÇƤ·¤¿¡ª",d_name+d_info[dungeon_type].name);
1477 msg_format("You have conquered %s!",d_name+d_info[dungeon_type].name);
1482 /* Determine how much we can drop */
1483 if ((r_ptr->flags1 & RF1_DROP_60) && (randint0(100) < 60)) number++;
1484 if ((r_ptr->flags1 & RF1_DROP_90) && (randint0(100) < 90)) number++;
1485 if (r_ptr->flags1 & RF1_DROP_1D2) number += damroll(1, 2);
1486 if (r_ptr->flags1 & RF1_DROP_2D2) number += damroll(2, 2);
1487 if (r_ptr->flags1 & RF1_DROP_3D2) number += damroll(3, 2);
1488 if (r_ptr->flags1 & RF1_DROP_4D2) number += damroll(4, 2);
1490 if (cloned && !(r_ptr->flags1 & RF1_UNIQUE))
1491 number = 0; /* Clones drop no stuff unless Cloning Pits */
1493 if (is_pet(m_ptr) || p_ptr->inside_battle || p_ptr->inside_arena)
1494 number = 0; /* Pets drop no stuff */
1495 if (!drop_item && (r_ptr->d_char != '$')) number = 0;
1497 if((r_ptr->flags2 & (RF2_MULTIPLY)) && (r_ptr->r_akills > 1024))
1498 number = 0; /* Limit of Multiply monster drop */
1500 /* Hack -- handle creeping coins */
1501 coin_type = force_coin;
1503 /* Average dungeon and monster levels */
1504 object_level = (dun_level + r_ptr->level) / 2;
1506 /* Drop some objects */
1507 for (j = 0; j < number; j++)
1509 /* Get local object */
1512 /* Wipe the object */
1516 if (do_gold && (!do_item || (randint0(100) < 50)))
1518 /* Make some gold */
1519 if (!make_gold(q_ptr)) continue;
1528 /* Make an object */
1529 if (!make_object(q_ptr, mo_mode)) continue;
1535 /* Drop it in the dungeon */
1536 (void)drop_near(q_ptr, -1, y, x);
1539 /* Reset the object level */
1540 object_level = base_level;
1542 /* Reset "coin" type */
1546 /* Take note of any dropped treasure */
1547 if (visible && (dump_item || dump_gold))
1549 /* Take notes on treasure */
1550 lore_treasure(m_idx, dump_item, dump_gold);
1553 /* Only process "Quest Monsters" */
1554 if (!(r_ptr->flags1 & RF1_QUESTOR)) return;
1555 if (p_ptr->inside_battle) return;
1558 if ((m_ptr->r_idx == MON_SERPENT) && !cloned)
1561 p_ptr->total_winner = TRUE;
1563 /* Redraw the "title" */
1564 p_ptr->redraw |= (PR_TITLE);
1567 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "¸«»ö¤ËÊѶòÈÚÅܤξ¡Íø¼Ô¤È¤Ê¤Ã¤¿¡ª");
1569 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "become *WINNER* of Hengband finely!");
1572 if ((p_ptr->pclass == CLASS_CHAOS_WARRIOR) || (p_ptr->muta2 & MUT2_CHAOS_GIFT))
1575 msg_format("%s¤«¤é¤ÎÀ¼¤¬¶Á¤¤¤¿¡£", chaos_patrons[p_ptr->chaos_patron]);
1576 msg_print("¡Ø¤è¤¯¤ä¤Ã¤¿¡¢ÄêÌ¿¤Î¼Ô¤è¡ª¡Ù");
1578 msg_format("The voice of %s booms out:", chaos_patrons[p_ptr->chaos_patron]);
1579 msg_print("'Thou art donst well, mortal!'");
1583 /* Congratulations */
1585 msg_print("*** ¤ª¤á¤Ç¤È¤¦ ***");
1587 msg_print("*** CONGRATULATIONS ***");
1591 msg_print("¤¢¤Ê¤¿¤Ï¥²¡¼¥à¤ò¥³¥ó¥×¥ê¡¼¥È¤·¤Þ¤·¤¿¡£");
1593 msg_print("You have won the game!");
1597 msg_print("½àÈ÷¤¬À°¤Ã¤¿¤é°úÂà(¼«»¦¥³¥Þ¥ó¥É)¤·¤Æ¤â·ë¹½¤Ç¤¹¡£");
1599 msg_print("You may retire (commit suicide) when you are ready.");
1605 * Modify the physical damage done to the monster.
1606 * (for example when it's invulnerable or shielded)
1608 * ToDo: Accept a damage-type to calculate the modified damage from
1609 * things like fire, frost, lightning, poison, ... attacks.
1611 * "type" is not yet used and should be 0.
1613 int mon_damage_mod(monster_type *m_ptr, int dam, bool is_psy_spear)
1615 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1617 if ((r_ptr->flagsr & RFR_RES_ALL) && dam > 0)
1620 if ((dam == 0) && one_in_(3)) dam = 1;
1623 if (MON_INVULNER(m_ptr))
1627 if (!p_ptr->blind && is_seen(m_ptr))
1630 msg_print("¥Ð¥ê¥¢¤òÀÚ¤êÎö¤¤¤¿¡ª");
1632 msg_print("The barrier is penetrated!");
1636 else if (!one_in_(PENETRATE_INVULNERABILITY))
1646 * Calculate experience point to be get
1648 * Even the 64 bit operation is not big enough to avoid overflaw
1649 * unless we carefully choose orders of multiplication and division.
1651 * Get the coefficient first, and multiply (potentially huge) base
1652 * experience point of a monster later.
1654 static void get_exp_from_mon(int dam, monster_type *m_ptr)
1656 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1663 if (!m_ptr->r_idx) return;
1664 if (is_pet(m_ptr) || p_ptr->inside_battle) return;
1667 * - Ratio of monster's level to player's level effects
1668 * - Varying speed effects
1669 * - Get a fraction in proportion of damage point
1671 new_exp = r_ptr->level * SPEED_TO_ENERGY(m_ptr->mspeed) * dam;
1674 div_l = (p_ptr->max_plv+2) * SPEED_TO_ENERGY(r_ptr->speed);
1676 /* Use (average maxhp * 2) as a denominator */
1677 if (!(r_ptr->flags1 & RF1_FORCE_MAXHP))
1678 s64b_mul(&div_h, &div_l, 0, r_ptr->hdice * (ironman_nightmare ? 2 : 1) * (r_ptr->hside + 1));
1680 s64b_mul(&div_h, &div_l, 0, r_ptr->hdice * (ironman_nightmare ? 2 : 1) * r_ptr->hside * 2);
1682 /* Special penalty in the wilderness */
1683 if (!dun_level && (!(r_ptr->flags8 & RF8_WILD_ONLY) || !(r_ptr->flags1 & RF1_UNIQUE)))
1684 s64b_mul(&div_h, &div_l, 0, 5);
1686 /* Do division first to prevent overflaw */
1687 s64b_div(&new_exp, &new_exp_frac, div_h, div_l);
1689 /* Special penalty for mutiply-monster */
1690 if ((r_ptr->flags2 & RF2_MULTIPLY) || (m_ptr->r_idx == MON_DAWN))
1692 int monnum_penarty = r_ptr->r_akills / 400;
1693 if (monnum_penarty > 8) monnum_penarty = 8;
1695 while (monnum_penarty--)
1698 s64b_RSHIFT(new_exp, new_exp_frac, 2);
1702 /* Special penalty for rest_and_shoot exp scum */
1703 if ((m_ptr->dealt_damage > m_ptr->max_maxhp) && (m_ptr->hp >= 0))
1705 int over_damage = m_ptr->dealt_damage / m_ptr->max_maxhp;
1706 if (over_damage > 32) over_damage = 32;
1708 while (over_damage--)
1711 s64b_mul(&new_exp, &new_exp_frac, 0, 9);
1712 s64b_div(&new_exp, &new_exp_frac, 0, 10);
1716 /* Finally multiply base experience point of the monster */
1717 s64b_mul(&new_exp, &new_exp_frac, 0, r_ptr->mexp);
1719 /* Gain experience */
1720 gain_exp_64(new_exp, new_exp_frac);
1725 * Decreases monsters hit points, handling monster death.
1727 * We return TRUE if the monster has been killed (and deleted).
1729 * We announce monster death (using an optional "death message"
1730 * if given, and a otherwise a generic killed/destroyed message).
1732 * Only "physical attacks" can induce the "You have slain" message.
1733 * Missile and Spell attacks will induce the "dies" message, or
1734 * various "specialized" messages. Note that "You have destroyed"
1735 * and "is destroyed" are synonyms for "You have slain" and "dies".
1737 * Hack -- unseen monsters yield "You have killed it." message.
1739 * Added fear (DGK) and check whether to print fear messages -CWS
1741 * Made name, sex, and capitalization generic -BEN-
1743 * As always, the "ghost" processing is a total hack.
1745 * Hack -- we "delay" fear messages by passing around a "fear" flag.
1747 * XXX XXX XXX Consider decreasing monster experience over time, say,
1748 * by using "(m_exp * m_lev * (m_lev)) / (p_lev * (m_lev + n_killed))"
1749 * instead of simply "(m_exp * m_lev) / (p_lev)", to make the first
1750 * monster worth more than subsequent monsters. This would also need
1751 * to induce changes in the monster recall code.
1753 bool mon_take_hit(int m_idx, int dam, bool *fear, cptr note)
1755 monster_type *m_ptr = &m_list[m_idx];
1756 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1758 monster_type exp_mon;
1760 /* Innocent until proven otherwise */
1761 bool innocent = TRUE, thief = FALSE;
1766 (void)COPY(&exp_mon, m_ptr, monster_type);
1768 expdam = (m_ptr->hp > dam) ? dam : m_ptr->hp;
1770 get_exp_from_mon(expdam, &exp_mon);
1772 /* Genocided by chaos patron */
1773 if (!m_ptr->r_idx) m_idx = 0;
1775 /* Redraw (later) if needed */
1776 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1777 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
1780 (void)set_monster_csleep(m_idx, 0);
1782 /* Hack - Cancel any special player stealth magics. -LM- */
1783 if (p_ptr->special_defense & NINJA_S_STEALTH)
1785 set_superstealth(FALSE);
1788 /* Genocided by chaos patron */
1789 if (!m_idx) return TRUE;
1791 /* Remember dealt_damage before this attack*/
1792 dealt_damage = m_ptr->dealt_damage;
1797 m_ptr->dealt_damage += dam;
1798 if(m_ptr->dealt_damage > m_ptr->max_maxhp * 100) m_ptr->dealt_damage = m_ptr->max_maxhp * 100;
1801 msg_format( _("¹ç·×%d/%d¤Î¥À¥á¡¼¥¸¤òÍ¿¤¨¤¿¡£","You do %d (out of %d) damage."),
1802 m_ptr->dealt_damage, m_ptr->maxhp);
1805 /* It is dead now */
1810 if (r_info[m_ptr->r_idx].flags7 & RF7_TANUKI)
1812 /* You might have unmasked Tanuki first time */
1813 r_ptr = &r_info[m_ptr->r_idx];
1814 m_ptr->ap_r_idx = m_ptr->r_idx;
1815 if (r_ptr->r_sights < MAX_SHORT) r_ptr->r_sights++;
1818 if (m_ptr->mflag2 & MFLAG2_CHAMELEON)
1820 /* You might have unmasked Chameleon first time */
1821 r_ptr = real_r_ptr(m_ptr);
1822 if (r_ptr->r_sights < MAX_SHORT) r_ptr->r_sights++;
1825 if (!(m_ptr->smart & SM_CLONED))
1827 /* When the player kills a Unique, it stays dead */
1828 if (r_ptr->flags1 & RF1_UNIQUE)
1832 /* Mega-Hack -- Banor & Lupart */
1833 if ((m_ptr->r_idx == MON_BANOR) || (m_ptr->r_idx == MON_LUPART))
1835 r_info[MON_BANORLUPART].max_num = 0;
1836 r_info[MON_BANORLUPART].r_pkills++;
1837 r_info[MON_BANORLUPART].r_akills++;
1838 if (r_info[MON_BANORLUPART].r_tkills < MAX_SHORT) r_info[MON_BANORLUPART].r_tkills++;
1840 else if (m_ptr->r_idx == MON_BANORLUPART)
1842 r_info[MON_BANOR].max_num = 0;
1843 r_info[MON_BANOR].r_pkills++;
1844 r_info[MON_BANOR].r_akills++;
1845 if (r_info[MON_BANOR].r_tkills < MAX_SHORT) r_info[MON_BANOR].r_tkills++;
1846 r_info[MON_LUPART].max_num = 0;
1847 r_info[MON_LUPART].r_pkills++;
1848 r_info[MON_LUPART].r_akills++;
1849 if (r_info[MON_LUPART].r_tkills < MAX_SHORT) r_info[MON_LUPART].r_tkills++;
1853 /* When the player kills a Nazgul, it stays dead */
1854 else if (r_ptr->flags7 & RF7_NAZGUL) r_ptr->max_num--;
1857 /* Count all monsters killed */
1858 if (r_ptr->r_akills < MAX_SHORT) r_ptr->r_akills++;
1860 /* Recall even invisible uniques or winners */
1861 if ((m_ptr->ml && !p_ptr->image) || (r_ptr->flags1 & RF1_UNIQUE))
1863 /* Count kills this life */
1864 if ((m_ptr->mflag2 & MFLAG2_KAGE) && (r_info[MON_KAGE].r_pkills < MAX_SHORT)) r_info[MON_KAGE].r_pkills++;
1865 else if (r_ptr->r_pkills < MAX_SHORT) r_ptr->r_pkills++;
1867 /* Count kills in all lives */
1868 if ((m_ptr->mflag2 & MFLAG2_KAGE) && (r_info[MON_KAGE].r_tkills < MAX_SHORT)) r_info[MON_KAGE].r_tkills++;
1869 else if (r_ptr->r_tkills < MAX_SHORT) r_ptr->r_tkills++;
1871 /* Hack -- Auto-recall */
1872 monster_race_track(m_ptr->ap_r_idx);
1875 /* Extract monster name */
1876 monster_desc(m_name, m_ptr, MD_TRUE_NAME);
1878 /* Don't kill Amberites */
1879 if ((r_ptr->flags3 & RF3_AMBERITE) && one_in_(2))
1881 int curses = 1 + randint1(3);
1882 bool stop_ty = FALSE;
1886 msg_format("%^s¤Ï¶²¤í¤·¤¤·ì¤Î¼ö¤¤¤ò¤¢¤Ê¤¿¤Ë¤«¤±¤¿¡ª", m_name);
1888 msg_format("%^s puts a terrible blood curse on you!", m_name);
1891 curse_equipment(100, 50);
1895 stop_ty = activate_ty_curse(stop_ty, &count);
1900 if (r_ptr->flags2 & RF2_CAN_SPEAK)
1902 char line_got[1024];
1904 /* Dump a message */
1906 if (!get_rnd_line("mondeath_j.txt", m_ptr->r_idx, line_got))
1908 if (!get_rnd_line("mondeath.txt", m_ptr->r_idx, line_got))
1911 msg_format("%^s %s", m_name, line_got);
1914 if (m_ptr->r_idx == MON_SERPENT)
1916 /* Make screen dump */
1917 screen_dump = make_screen_dump();
1922 if (!(d_info[dungeon_type].flags1 & DF1_BEGINNER))
1924 if (!dun_level && !ambush_flag && !p_ptr->inside_arena)
1926 chg_virtue(V_VALOUR, -1);
1928 else if (r_ptr->level > dun_level)
1930 if (randint1(10) <= (r_ptr->level - dun_level))
1931 chg_virtue(V_VALOUR, 1);
1933 if (r_ptr->level > 60)
1935 chg_virtue(V_VALOUR, 1);
1937 if (r_ptr->level >= 2 * (p_ptr->lev+1))
1938 chg_virtue(V_VALOUR, 2);
1941 if (r_ptr->flags1 & RF1_UNIQUE)
1943 if (r_ptr->flags3 & (RF3_EVIL | RF3_GOOD)) chg_virtue(V_HARMONY, 2);
1945 if (r_ptr->flags3 & RF3_GOOD)
1947 chg_virtue(V_UNLIFE, 2);
1948 chg_virtue(V_VITALITY, -2);
1951 if (one_in_(3)) chg_virtue(V_INDIVIDUALISM, -1);
1954 if (m_ptr->r_idx == MON_BEGGAR || m_ptr->r_idx == MON_LEPER)
1956 chg_virtue(V_COMPASSION, -1);
1959 if ((r_ptr->flags3 & RF3_GOOD) &&
1960 ((r_ptr->level) / 10 + (3 * dun_level) >= randint1(100)))
1961 chg_virtue(V_UNLIFE, 1);
1963 if (r_ptr->d_char == 'A')
1965 if (r_ptr->flags1 & RF1_UNIQUE)
1966 chg_virtue(V_FAITH, -2);
1967 else if ((r_ptr->level) / 10 + (3 * dun_level) >= randint1(100))
1969 if (r_ptr->flags3 & RF3_GOOD) chg_virtue(V_FAITH, -1);
1970 else chg_virtue(V_FAITH, 1);
1973 else if (r_ptr->flags3 & RF3_DEMON)
1975 if (r_ptr->flags1 & RF1_UNIQUE)
1976 chg_virtue(V_FAITH, 2);
1977 else if ((r_ptr->level) / 10 + (3 * dun_level) >= randint1(100))
1978 chg_virtue(V_FAITH, 1);
1981 if ((r_ptr->flags3 & RF3_UNDEAD) && (r_ptr->flags1 & RF1_UNIQUE))
1982 chg_virtue(V_VITALITY, 2);
1984 if (r_ptr->r_deaths)
1986 if (r_ptr->flags1 & RF1_UNIQUE)
1988 chg_virtue(V_HONOUR, 10);
1990 else if ((r_ptr->level) / 10 + (2 * dun_level) >= randint1(100))
1992 chg_virtue(V_HONOUR, 1);
1995 if ((r_ptr->flags2 & RF2_MULTIPLY) && (r_ptr->r_akills > 1000) && one_in_(10))
1997 chg_virtue(V_VALOUR, -1);
2000 for (i = 0; i < 4; i++)
2002 if (r_ptr->blow[i].d_dice != 0) innocent = FALSE; /* Murderer! */
2004 if ((r_ptr->blow[i].effect == RBE_EAT_ITEM)
2005 || (r_ptr->blow[i].effect == RBE_EAT_GOLD))
2007 thief = TRUE; /* Thief! */
2010 /* The new law says it is illegal to live in the dungeon */
2011 if (r_ptr->level != 0) innocent = FALSE;
2015 if (r_ptr->flags1 & RF1_UNIQUE)
2016 chg_virtue(V_JUSTICE, 3);
2017 else if (1+((r_ptr->level) / 10 + (2 * dun_level))
2019 chg_virtue(V_JUSTICE, 1);
2023 chg_virtue (V_JUSTICE, -1);
2026 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)))
2028 if (one_in_(4)) chg_virtue(V_NATURE, -1);
2031 if ((r_ptr->flags1 & RF1_UNIQUE) && record_destroy_uniq)
2035 sprintf(note_buf, "%s%s", r_name + r_ptr->name, (m_ptr->smart & SM_CLONED) ? "(¥¯¥í¡¼¥ó)" : "");
2037 sprintf(note_buf, "%s%s", r_name + r_ptr->name, (m_ptr->smart & SM_CLONED) ? "(Clone)" : "");
2039 do_cmd_write_nikki(NIKKI_UNIQUE, 0, note_buf);
2045 /* Death by Missile/Spell attack */
2048 msg_format("%^s%s", m_name, note);
2051 /* Death by physical attack -- invisible monster */
2052 else if (!m_ptr->ml)
2055 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
2056 msg_format("¤»¤Ã¤«¤¯¤À¤«¤é%s¤ò»¦¤·¤¿¡£", m_name);
2058 msg_format("%s¤ò»¦¤·¤¿¡£", m_name);
2060 msg_format("You have killed %s.", m_name);
2065 /* Death by Physical attack -- non-living monster */
2066 else if (!monster_living(r_ptr))
2069 bool explode = FALSE;
2071 for (i = 0; i < 4; i++)
2073 if (r_ptr->blow[i].method == RBM_EXPLODE) explode = TRUE;
2076 /* Special note at death */
2079 msg_format("%s¤ÏÇúȯ¤·¤ÆÊ´¡¹¤Ë¤Ê¤Ã¤¿¡£", m_name);
2081 msg_format("%^s explodes into tiny shreds.", m_name);
2086 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
2087 msg_format("¤»¤Ã¤«¤¯¤À¤«¤é%s¤òÅݤ·¤¿¡£", m_name);
2089 msg_format("%s¤òÅݤ·¤¿¡£", m_name);
2091 msg_format("You have destroyed %s.", m_name);
2096 /* Death by Physical attack -- living monster */
2100 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
2101 msg_format("¤»¤Ã¤«¤¯¤À¤«¤é%s¤òÁò¤êµî¤Ã¤¿¡£", m_name);
2103 msg_format("%s¤òÁò¤êµî¤Ã¤¿¡£", m_name);
2105 msg_format("You have slain %s.", m_name);
2109 if ((r_ptr->flags1 & RF1_UNIQUE) && !(m_ptr->smart & SM_CLONED) && !vanilla_town)
2111 for (i = 0; i < MAX_KUBI; i++)
2113 if ((kubi_r_idx[i] == m_ptr->r_idx) && !(m_ptr->mflag2 & MFLAG2_CHAMELEON))
2116 msg_format("%s¤Î¼ó¤Ë¤Ï¾Þ¶â¤¬¤«¤«¤Ã¤Æ¤¤¤ë¡£", m_name);
2118 msg_format("There is a price on %s's head.", m_name);
2125 /* Generate treasure */
2126 monster_death(m_idx, TRUE);
2128 /* Mega hack : replace IKETA to BIKETAL */
2129 if ((m_ptr->r_idx == MON_IKETA) &&
2130 !(p_ptr->inside_arena || p_ptr->inside_battle))
2132 int dummy_y = m_ptr->fy;
2133 int dummy_x = m_ptr->fx;
2136 if (is_pet(m_ptr)) mode |= PM_FORCE_PET;
2138 /* Delete the monster */
2139 delete_monster_idx(m_idx);
2141 if (summon_named_creature(0, dummy_y, dummy_x, MON_BIKETAL, mode))
2144 msg_print("¡Ö¥Ï¥¡¥Ã¥Ï¥Ã¥Ï¥Ã¥Ï¡ª¡ª»ä¤¬¥Ð¥¤¥±¥¿¥ë¤À¡ª¡ª¡×");
2146 msg_print("Uwa-hahaha! *I* am Biketal!");
2152 /* Delete the monster */
2153 delete_monster_idx(m_idx);
2156 get_exp_from_mon((long)exp_mon.max_maxhp*2, &exp_mon);
2161 /* Monster is dead */
2168 /* Mega-Hack -- Pain cancels fear */
2169 if (MON_MONFEAR(m_ptr) && (dam > 0))
2172 if (set_monster_monfear(m_idx, MON_MONFEAR(m_ptr) - randint1(dam)))
2179 /* Sometimes a monster gets scared by damage */
2180 if (!MON_MONFEAR(m_ptr) && !(r_ptr->flags3 & (RF3_NO_FEAR)))
2182 /* Percentage of fully healthy */
2183 int percentage = (100L * m_ptr->hp) / m_ptr->maxhp;
2186 * Run (sometimes) if at 10% or less of max hit points,
2187 * or (usually) when hit for half its current hit points
2189 if ((randint1(10) >= percentage) ||
2190 ((dam >= m_ptr->hp) && (randint0(100) < 80)))
2192 /* Hack -- note fear */
2195 /* XXX XXX XXX Hack -- Add some timed fear */
2196 (void)set_monster_monfear(m_idx, (randint1(10) +
2197 (((dam >= m_ptr->hp) && (percentage > 7)) ?
2198 20 : ((11 - percentage) * 5))));
2205 if (p_ptr->riding && (p_ptr->riding == m_idx) && (dam > 0))
2209 /* Extract monster name */
2210 monster_desc(m_name, m_ptr, 0);
2212 if (m_ptr->hp > m_ptr->maxhp/3) dam = (dam + 1) / 2;
2213 if (rakuba((dam > 200) ? 200 : dam, FALSE))
2216 msg_format("%^s¤Ë¿¶¤êÍî¤È¤µ¤ì¤¿¡ª", m_name);
2218 msg_format("%^s has thrown you off!", m_name);
2230 * Get term size and calculate screen size
2232 void get_screen_size(int *wid_p, int *hgt_p)
2234 Term_get_size(wid_p, hgt_p);
2235 *hgt_p -= ROW_MAP + 2;
2236 *wid_p -= COL_MAP + 2;
2237 if (use_bigtile) *wid_p /= 2;
2242 * Calculates current boundaries
2243 * Called below and from "do_cmd_locate()".
2245 void panel_bounds_center(void)
2250 get_screen_size(&wid, &hgt);
2252 panel_row_max = panel_row_min + hgt - 1;
2253 panel_row_prt = panel_row_min - 1;
2254 panel_col_max = panel_col_min + wid - 1;
2255 panel_col_prt = panel_col_min - 13;
2260 * Map resizing whenever the main term changes size
2262 void resize_map(void)
2264 /* Only if the dungeon exists */
2265 if (!character_dungeon) return;
2267 /* Mega-Hack -- no panel yet */
2271 /* Reset the panels */
2272 panel_row_min = cur_hgt;
2273 panel_col_min = cur_wid;
2278 p_ptr->update |= (PU_TORCH | PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
2280 /* Forget lite/view */
2281 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
2283 /* Update lite/view */
2284 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
2286 /* Update monsters */
2287 p_ptr->update |= (PU_MONSTERS);
2289 /* Redraw everything */
2290 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
2292 /* Hack -- update */
2300 * Place the cursor on the player
2302 if (can_save) move_cursor_relative(py, px);
2309 * Redraw a term when it is resized
2311 void redraw_window(void)
2313 /* Only if the dungeon exists */
2314 if (!character_dungeon) return;
2317 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
2320 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
2322 /* Hack -- update */
2331 * Handle a request to change the current panel
2333 * Return TRUE if the panel was changed.
2335 * Also used in do_cmd_locate
2337 bool change_panel(int dy, int dx)
2343 get_screen_size(&wid, &hgt);
2345 /* Apply the motion */
2346 y = panel_row_min + dy * hgt / 2;
2347 x = panel_col_min + dx * wid / 2;
2349 /* Verify the row */
2350 if (y > cur_hgt - hgt) y = cur_hgt - hgt;
2353 /* Verify the col */
2354 if (x > cur_wid - wid) x = cur_wid - wid;
2357 /* Handle "changes" */
2358 if ((y != panel_row_min) || (x != panel_col_min))
2360 /* Save the new panel info */
2364 /* Recalculate the boundaries */
2365 panel_bounds_center();
2368 p_ptr->update |= (PU_MONSTERS);
2371 p_ptr->redraw |= (PR_MAP);
2384 bool change_panel_xy(int y, int x)
2390 get_screen_size(&wid, &hgt);
2392 if (y < panel_row_min) dy = -1;
2393 if (y > panel_row_max) dy = 1;
2394 if (x < panel_col_min) dx = -1;
2395 if (x > panel_col_max) dx = 1;
2397 if (!dy && !dx) return (FALSE);
2399 return change_panel(dy, dx);
2404 * Given an row (y) and col (x), this routine detects when a move
2405 * off the screen has occurred and figures new borders. -RAK-
2407 * "Update" forces a "full update" to take place.
2409 * The map is reprinted if necessary, and "TRUE" is returned.
2411 void verify_panel(void)
2423 get_screen_size(&wid, &hgt);
2425 max_prow_min = cur_hgt - hgt;
2426 max_pcol_min = cur_wid - wid;
2428 /* Bounds checking */
2429 if (max_prow_min < 0) max_prow_min = 0;
2430 if (max_pcol_min < 0) max_pcol_min = 0;
2432 /* Center on player */
2433 if (center_player && (center_running || !running))
2435 /* Center vertically */
2436 prow_min = y - hgt / 2;
2437 if (prow_min < 0) prow_min = 0;
2438 else if (prow_min > max_prow_min) prow_min = max_prow_min;
2440 /* Center horizontally */
2441 pcol_min = x - wid / 2;
2442 if (pcol_min < 0) pcol_min = 0;
2443 else if (pcol_min > max_pcol_min) pcol_min = max_pcol_min;
2447 prow_min = panel_row_min;
2448 pcol_min = panel_col_min;
2450 /* Scroll screen when 2 grids from top/bottom edge */
2451 if (y > panel_row_max - 2)
2453 while (y > prow_min + hgt-1 - 2)
2455 prow_min += (hgt / 2);
2459 if (y < panel_row_min + 2)
2461 while (y < prow_min + 2)
2463 prow_min -= (hgt / 2);
2467 if (prow_min > max_prow_min) prow_min = max_prow_min;
2468 if (prow_min < 0) prow_min = 0;
2470 /* Scroll screen when 4 grids from left/right edge */
2471 if (x > panel_col_max - 4)
2473 while (x > pcol_min + wid-1 - 4)
2475 pcol_min += (wid / 2);
2479 if (x < panel_col_min + 4)
2481 while (x < pcol_min + 4)
2483 pcol_min -= (wid / 2);
2487 if (pcol_min > max_pcol_min) pcol_min = max_pcol_min;
2488 if (pcol_min < 0) pcol_min = 0;
2491 /* Check for "no change" */
2492 if ((prow_min == panel_row_min) && (pcol_min == panel_col_min)) return;
2494 /* Save the new panel info */
2495 panel_row_min = prow_min;
2496 panel_col_min = pcol_min;
2498 /* Hack -- optional disturb on "panel change" */
2499 if (disturb_panel && !center_player) disturb(0, 0);
2501 /* Recalculate the boundaries */
2502 panel_bounds_center();
2505 p_ptr->update |= (PU_MONSTERS);
2508 p_ptr->redraw |= (PR_MAP);
2511 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
2516 * Monster health description
2518 cptr look_mon_desc(monster_type *m_ptr, u32b mode)
2520 monster_race *ap_r_ptr = &r_info[m_ptr->ap_r_idx];
2527 /* Determine if the monster is "living" */
2528 living = monster_living(ap_r_ptr);
2530 /* Calculate a health "percentage" */
2531 perc = 100L * m_ptr->hp / m_ptr->maxhp;
2533 /* Healthy monsters */
2534 if (m_ptr->hp >= m_ptr->maxhp)
2538 desc = living ? "̵½ý" : "̵¥À¥á¡¼¥¸";
2540 desc = living ? "unhurt" : "undamaged";
2545 else if (perc >= 60)
2548 desc = living ? "·Ú½ý" : "¾®¥À¥á¡¼¥¸";
2550 desc = living ? "somewhat wounded" : "somewhat damaged";
2555 else if (perc >= 25)
2558 desc = living ? "Éé½ý" : "Ãæ¥À¥á¡¼¥¸";
2560 desc = living ? "wounded" : "damaged";
2565 else if (perc >= 10)
2568 desc = living ? "½Å½ý" : "Âç¥À¥á¡¼¥¸";
2570 desc = living ? "badly wounded" : "badly damaged";
2578 desc = living ? "Ⱦ»àȾÀ¸" : "Åݤ줫¤±";
2580 desc = living ? "almost dead" : "almost destroyed";
2585 /* Need attitude information? */
2588 /* Full information is not needed */
2591 else if (is_pet(m_ptr))
2594 attitude = ", ¥Ú¥Ã¥È";
2599 else if (is_friendly(m_ptr))
2602 attitude = ", ͧ¹¥Åª";
2604 attitude = ", friendly";
2617 /* Clone monster? */
2618 if (m_ptr->smart & SM_CLONED)
2627 /* Display monster's level --- idea borrowed from ToME */
2628 if (ap_r_ptr->r_tkills && !(m_ptr->mflag2 & MFLAG2_KAGE))
2631 return format("¥ì¥Ù¥ë%d, %s%s%s", ap_r_ptr->level, desc, attitude, clone);
2633 return format("Level %d, %s%s%s", ap_r_ptr->level, desc, attitude, clone);
2639 return format("¥ì¥Ù¥ë???, %s%s%s", desc, attitude, clone);
2641 return format("Level ???, %s%s%s", desc, attitude, clone);
2649 * Angband sorting algorithm -- quick sort in place
2651 * Note that the details of the data we are sorting is hidden,
2652 * and we rely on the "ang_sort_comp()" and "ang_sort_swap()"
2653 * function hooks to interact with the data, which is given as
2654 * two pointers, and which may have any user-defined form.
2656 void ang_sort_aux(vptr u, vptr v, int p, int q)
2674 while (!(*ang_sort_comp)(u, v, b, z)) b--;
2677 while (!(*ang_sort_comp)(u, v, z, a)) a++;
2679 /* Done partition */
2683 (*ang_sort_swap)(u, v, a, b);
2689 /* Recurse left side */
2690 ang_sort_aux(u, v, p, b);
2692 /* Recurse right side */
2693 ang_sort_aux(u, v, b+1, q);
2698 * Angband sorting algorithm -- quick sort in place
2700 * Note that the details of the data we are sorting is hidden,
2701 * and we rely on the "ang_sort_comp()" and "ang_sort_swap()"
2702 * function hooks to interact with the data, which is given as
2703 * two pointers, and which may have any user-defined form.
2705 void ang_sort(vptr u, vptr v, int n)
2707 /* Sort the array */
2708 ang_sort_aux(u, v, 0, n-1);
2713 /*** Targeting Code ***/
2717 * Determine is a monster makes a reasonable target
2719 * The concept of "targeting" was stolen from "Morgul" (?)
2721 * The player can target any location, or any "target-able" monster.
2723 * Currently, a monster is "target_able" if it is visible, and if
2724 * the player can hit it with a projection, and the player is not
2725 * hallucinating. This allows use of "use closest target" macros.
2727 * Future versions may restrict the ability to target "trappers"
2728 * and "mimics", but the semantics is a little bit weird.
2730 bool target_able(int m_idx)
2732 monster_type *m_ptr = &m_list[m_idx];
2734 /* Monster must be alive */
2735 if (!m_ptr->r_idx) return (FALSE);
2737 /* Hack -- no targeting hallucinations */
2738 if (p_ptr->image) return (FALSE);
2740 /* Monster must be visible */
2741 if (!m_ptr->ml) return (FALSE);
2743 if (p_ptr->riding && (p_ptr->riding == m_idx)) return (TRUE);
2745 /* Monster must be projectable */
2746 if (!projectable(py, px, m_ptr->fy, m_ptr->fx)) return (FALSE);
2748 /* XXX XXX XXX Hack -- Never target trappers */
2749 /* if (CLEAR_ATTR && (CLEAR_CHAR)) return (FALSE); */
2759 * Update (if necessary) and verify (if possible) the target.
2761 * We return TRUE if the target is "okay" and FALSE otherwise.
2763 bool target_okay(void)
2765 /* Accept stationary targets */
2766 if (target_who < 0) return (TRUE);
2768 /* Check moving targets */
2771 /* Accept reasonable targets */
2772 if (target_able(target_who))
2774 monster_type *m_ptr = &m_list[target_who];
2776 /* Acquire monster location */
2777 target_row = m_ptr->fy;
2778 target_col = m_ptr->fx;
2785 /* Assume no target */
2791 * Sorting hook -- comp function -- by "distance to player"
2793 * We use "u" and "v" to point to arrays of "x" and "y" positions,
2794 * and sort the arrays by double-distance to the player.
2796 static bool ang_sort_comp_distance(vptr u, vptr v, int a, int b)
2798 byte *x = (byte*)(u);
2799 byte *y = (byte*)(v);
2803 /* Absolute distance components */
2804 kx = x[a]; kx -= px; kx = ABS(kx);
2805 ky = y[a]; ky -= py; ky = ABS(ky);
2807 /* Approximate Double Distance to the first point */
2808 da = ((kx > ky) ? (kx + kx + ky) : (ky + ky + kx));
2810 /* Absolute distance components */
2811 kx = x[b]; kx -= px; kx = ABS(kx);
2812 ky = y[b]; ky -= py; ky = ABS(ky);
2814 /* Approximate Double Distance to the first point */
2815 db = ((kx > ky) ? (kx + kx + ky) : (ky + ky + kx));
2817 /* Compare the distances */
2823 * Sorting hook -- comp function -- by importance level of grids
2825 * We use "u" and "v" to point to arrays of "x" and "y" positions,
2826 * and sort the arrays by level of monster
2828 static bool ang_sort_comp_importance(vptr u, vptr v, int a, int b)
2830 byte *x = (byte*)(u);
2831 byte *y = (byte*)(v);
2832 cave_type *ca_ptr = &cave[y[a]][x[a]];
2833 cave_type *cb_ptr = &cave[y[b]][x[b]];
2834 monster_type *ma_ptr = &m_list[ca_ptr->m_idx];
2835 monster_type *mb_ptr = &m_list[cb_ptr->m_idx];
2836 monster_race *ap_ra_ptr, *ap_rb_ptr;
2838 /* The player grid */
2839 if (y[a] == py && x[a] == px) return TRUE;
2840 if (y[b] == py && x[b] == px) return FALSE;
2842 /* Extract monster race */
2843 if (ca_ptr->m_idx && ma_ptr->ml) ap_ra_ptr = &r_info[ma_ptr->ap_r_idx];
2844 else ap_ra_ptr = NULL;
2845 if (cb_ptr->m_idx && mb_ptr->ml) ap_rb_ptr = &r_info[mb_ptr->ap_r_idx];
2846 else ap_rb_ptr = NULL;
2848 if (ap_ra_ptr && !ap_rb_ptr) return TRUE;
2849 if (!ap_ra_ptr && ap_rb_ptr) return FALSE;
2851 /* Compare two monsters */
2852 if (ap_ra_ptr && ap_rb_ptr)
2854 /* Unique monsters first */
2855 if ((ap_ra_ptr->flags1 & RF1_UNIQUE) && !(ap_rb_ptr->flags1 & RF1_UNIQUE)) return TRUE;
2856 if (!(ap_ra_ptr->flags1 & RF1_UNIQUE) && (ap_rb_ptr->flags1 & RF1_UNIQUE)) return FALSE;
2858 /* Shadowers first (¤¢¤ä¤·¤¤±Æ) */
2859 if ((ma_ptr->mflag2 & MFLAG2_KAGE) && !(mb_ptr->mflag2 & MFLAG2_KAGE)) return TRUE;
2860 if (!(ma_ptr->mflag2 & MFLAG2_KAGE) && (mb_ptr->mflag2 & MFLAG2_KAGE)) return FALSE;
2862 /* Unknown monsters first */
2863 if (!ap_ra_ptr->r_tkills && ap_rb_ptr->r_tkills) return TRUE;
2864 if (ap_ra_ptr->r_tkills && !ap_rb_ptr->r_tkills) return FALSE;
2866 /* Higher level monsters first (if known) */
2867 if (ap_ra_ptr->r_tkills && ap_rb_ptr->r_tkills)
2869 if (ap_ra_ptr->level > ap_rb_ptr->level) return TRUE;
2870 if (ap_ra_ptr->level < ap_rb_ptr->level) return FALSE;
2873 /* Sort by index if all conditions are same */
2874 if (ma_ptr->ap_r_idx > mb_ptr->ap_r_idx) return TRUE;
2875 if (ma_ptr->ap_r_idx < mb_ptr->ap_r_idx) return FALSE;
2878 /* An object get higher priority */
2879 if (cave[y[a]][x[a]].o_idx && !cave[y[b]][x[b]].o_idx) return TRUE;
2880 if (!cave[y[a]][x[a]].o_idx && cave[y[b]][x[b]].o_idx) return FALSE;
2882 /* Priority from the terrain */
2883 if (f_info[ca_ptr->feat].priority > f_info[cb_ptr->feat].priority) return TRUE;
2884 if (f_info[ca_ptr->feat].priority < f_info[cb_ptr->feat].priority) return FALSE;
2886 /* If all conditions are same, compare distance */
2887 return ang_sort_comp_distance(u, v, a, b);
2892 * Sorting hook -- swap function -- by "distance to player"
2894 * We use "u" and "v" to point to arrays of "x" and "y" positions,
2895 * and sort the arrays by distance to the player.
2897 static void ang_sort_swap_distance(vptr u, vptr v, int a, int b)
2899 byte *x = (byte*)(u);
2900 byte *y = (byte*)(v);
2918 * Hack -- help "select" a location (see below)
2920 static s16b target_pick(int y1, int x1, int dy, int dx)
2924 int x2, y2, x3, y3, x4, y4;
2926 int b_i = -1, b_v = 9999;
2929 /* Scan the locations */
2930 for (i = 0; i < temp_n; i++)
2936 /* Directed distance */
2940 /* Verify quadrant */
2941 if (dx && (x3 * dx <= 0)) continue;
2942 if (dy && (y3 * dy <= 0)) continue;
2944 /* Absolute distance */
2948 /* Verify quadrant */
2949 if (dy && !dx && (x4 > y4)) continue;
2950 if (dx && !dy && (y4 > x4)) continue;
2952 /* Approximate Double Distance */
2953 v = ((x4 > y4) ? (x4 + x4 + y4) : (y4 + y4 + x4));
2955 /* XXX XXX XXX Penalize location */
2958 if ((b_i >= 0) && (v >= b_v)) continue;
2970 * Hack -- determine if a given location is "interesting"
2972 static bool target_set_accept(int y, int x)
2976 s16b this_o_idx, next_o_idx = 0;
2979 if (!(in_bounds(y, x))) return (FALSE);
2981 /* Player grid is always interesting */
2982 if (player_bold(y, x)) return (TRUE);
2985 /* Handle hallucination */
2986 if (p_ptr->image) return (FALSE);
2989 /* Examine the grid */
2990 c_ptr = &cave[y][x];
2992 /* Visible monsters */
2995 monster_type *m_ptr = &m_list[c_ptr->m_idx];
2997 /* Visible monsters */
2998 if (m_ptr->ml) return (TRUE);
3001 /* Scan all objects in the grid */
3002 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
3006 /* Acquire object */
3007 o_ptr = &o_list[this_o_idx];
3009 /* Acquire next object */
3010 next_o_idx = o_ptr->next_o_idx;
3012 /* Memorized object */
3013 if (o_ptr->marked & OM_FOUND) return (TRUE);
3016 /* Interesting memorized features */
3017 if (c_ptr->info & (CAVE_MARK))
3019 /* Notice object features */
3020 if (c_ptr->info & CAVE_OBJECT) return (TRUE);
3022 /* Feature code (applying "mimic" field) */
3023 if (have_flag(f_info[get_feat_mimic(c_ptr)].flags, FF_NOTICE)) return TRUE;
3032 * Prepare the "temp" array for "target_set"
3034 * Return the number of target_able monsters in the set.
3036 static void target_set_prepare(int mode)
3039 int min_hgt, max_hgt, min_wid, max_wid;
3041 if (mode & TARGET_KILL)
3044 min_hgt = MAX((py - MAX_RANGE), 0);
3045 max_hgt = MIN((py + MAX_RANGE), cur_hgt - 1);
3046 min_wid = MAX((px - MAX_RANGE), 0);
3047 max_wid = MIN((px + MAX_RANGE), cur_wid - 1);
3049 else /* not targetting */
3052 min_hgt = panel_row_min;
3053 max_hgt = panel_row_max;
3054 min_wid = panel_col_min;
3055 max_wid = panel_col_max;
3058 /* Reset "temp" array */
3061 /* Scan the current panel */
3062 for (y = min_hgt; y <= max_hgt; y++)
3064 for (x = min_wid; x <= max_wid; x++)
3068 /* Require "interesting" contents */
3069 if (!target_set_accept(y, x)) continue;
3071 c_ptr = &cave[y][x];
3073 /* Require target_able monsters for "TARGET_KILL" */
3074 if ((mode & (TARGET_KILL)) && !target_able(c_ptr->m_idx)) continue;
3076 if ((mode & (TARGET_KILL)) && !target_pet && is_pet(&m_list[c_ptr->m_idx])) continue;
3078 /* Save the location */
3085 /* Set the sort hooks */
3086 if (mode & (TARGET_KILL))
3088 /* Target the nearest monster for shooting */
3089 ang_sort_comp = ang_sort_comp_distance;
3090 ang_sort_swap = ang_sort_swap_distance;
3094 /* Look important grids first in Look command */
3095 ang_sort_comp = ang_sort_comp_importance;
3096 ang_sort_swap = ang_sort_swap_distance;
3099 /* Sort the positions */
3100 ang_sort(temp_x, temp_y, temp_n);
3102 if (p_ptr->riding && target_pet && (temp_n > 1) && (mode & (TARGET_KILL)))
3107 temp_y[0] = temp_y[1];
3110 temp_x[0] = temp_x[1];
3114 void target_set_prepare_look(){
3115 target_set_prepare(TARGET_LOOK);
3120 * Evaluate number of kill needed to gain level
3122 static void evaluate_monster_exp(char *buf, monster_type *m_ptr)
3124 monster_race *ap_r_ptr = &r_info[m_ptr->ap_r_idx];
3126 s32b exp_mon, exp_adv;
3127 u32b exp_mon_frac, exp_adv_frac;
3129 if ((p_ptr->lev >= PY_MAX_LEVEL) || (p_ptr->prace == RACE_ANDROID))
3134 else if (!ap_r_ptr->r_tkills || (m_ptr->mflag2 & MFLAG2_KAGE))
3144 /* The monster's experience point (assuming average monster speed) */
3145 exp_mon = ap_r_ptr->mexp * ap_r_ptr->level;
3147 s64b_div(&exp_mon, &exp_mon_frac, 0, (p_ptr->max_plv + 2));
3150 /* Total experience value for next level */
3151 exp_adv = player_exp[p_ptr->lev -1] * p_ptr->expfact;
3153 s64b_div(&exp_adv, &exp_adv_frac, 0, 100);
3155 /* Experience value need to get */
3156 s64b_sub(&exp_adv, &exp_adv_frac, p_ptr->exp, p_ptr->exp_frac);
3159 /* You need to kill at least one monster to get any experience */
3160 s64b_add(&exp_adv, &exp_adv_frac, exp_mon, exp_mon_frac);
3161 s64b_sub(&exp_adv, &exp_adv_frac, 0, 1);
3163 /* Extract number of monsters needed */
3164 s64b_div(&exp_adv, &exp_adv_frac, exp_mon, exp_mon_frac);
3166 /* If 999 or more monsters needed, only display "999". */
3167 num = MIN(999, exp_adv_frac);
3169 /* Display the number */
3170 sprintf(buf,"%03ld", (long int)num);
3174 bool show_gold_on_floor = FALSE;
3177 * Examine a grid, return a keypress.
3179 * The "mode" argument contains the "TARGET_LOOK" bit flag, which
3180 * indicates that the "space" key should scan through the contents
3181 * of the grid, instead of simply returning immediately. This lets
3182 * the "look" command get complete information, without making the
3183 * "target" command annoying.
3185 * The "info" argument contains the "commands" which should be shown
3186 * inside the "[xxx]" text. This string must never be empty, or grids
3187 * containing monsters will be displayed with an extra comma.
3189 * Note that if a monster is in the grid, we update both the monster
3190 * recall info and the health bar info to track that monster.
3192 * Eventually, we may allow multiple objects per grid, or objects
3193 * and terrain features in the same grid. XXX XXX XXX
3195 * This function must handle blindness/hallucination.
3197 static int target_set_aux(int y, int x, int mode, cptr info)
3199 cave_type *c_ptr = &cave[y][x];
3200 s16b this_o_idx, next_o_idx = 0;
3201 cptr s1 = "", s2 = "", s3 = "", x_info = "";
3204 feature_type *f_ptr;
3206 char out_val[MAX_NLEN+80];
3208 #ifdef ALLOW_EASY_FLOOR
3209 int floor_list[23], floor_num = 0;
3211 /* Scan all objects in the grid */
3214 floor_num = scan_floor(floor_list, y, x, 0x02);
3226 #endif /* ALLOW_EASY_FLOOR */
3228 /* Hack -- under the player */
3229 if (player_bold(y, x))
3252 /* Hack -- hallucination */
3256 cptr name = "²¿¤«´ñ̯¤Êʪ";
3258 cptr name = "something strange";
3262 /* Display a message */
3264 sprintf(out_val, "%s%s%s%s [%s]", s1, name, s2, s3, info);
3266 sprintf(out_val, "%s%s%s%s [%s]", s1, s2, s3, name, info);
3270 move_cursor_relative(y, x);
3273 /* Stop on everything but "return" */
3274 if ((query != '\r') && (query != '\n')) return query;
3276 /* Repeat forever */
3281 /* Actual monsters */
3282 if (c_ptr->m_idx && m_list[c_ptr->m_idx].ml)
3284 monster_type *m_ptr = &m_list[c_ptr->m_idx];
3285 monster_race *ap_r_ptr = &r_info[m_ptr->ap_r_idx];
3287 bool recall = FALSE;
3292 /* Get the monster name ("a kobold") */
3293 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
3295 /* Hack -- track this monster race */
3296 monster_race_track(m_ptr->ap_r_idx);
3298 /* Hack -- health bar for this monster */
3299 health_track(c_ptr->m_idx);
3301 /* Hack -- handle stuff */
3315 /* Recall on screen */
3316 screen_roff(m_ptr->ap_r_idx, 0);
3318 /* Hack -- Complete the prompt (again) */
3320 Term_addstr(-1, TERM_WHITE, format(" [r»× %s%s]", x_info, info));
3322 Term_addstr(-1, TERM_WHITE, format(" [r,%s%s]", x_info, info));
3331 /* Normal commands */
3332 if (query != 'r') break;
3337 /* Cleare recall text and repeat */
3343 /* Describe, and prompt for recall */
3344 evaluate_monster_exp(acount, m_ptr);
3347 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);
3349 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);
3355 move_cursor_relative(y, x);
3360 /* Normal commands */
3361 if (query != 'r') break;
3367 /* Always stop at "normal" keys */
3368 if ((query != '\r') && (query != '\n') && (query != ' ') && (query != 'x')) return query;
3370 /* Sometimes stop at "space" key */
3371 if ((query == ' ') && !(mode & (TARGET_LOOK))) return query;
3373 /* Change the intro */
3381 /* Hack -- take account of gender */
3383 if (ap_r_ptr->flags1 & (RF1_FEMALE)) s1 = "Èà½÷¤Ï";
3385 if (ap_r_ptr->flags1 & (RF1_FEMALE)) s1 = "She is ";
3389 else if (ap_r_ptr->flags1 & (RF1_MALE)) s1 = "Èà¤Ï";
3391 else if (ap_r_ptr->flags1 & (RF1_MALE)) s1 = "He is ";
3395 /* Use a preposition */
3404 /* Scan all objects being carried */
3405 for (this_o_idx = m_ptr->hold_o_idx; this_o_idx; this_o_idx = next_o_idx)
3407 char o_name[MAX_NLEN];
3411 /* Acquire object */
3412 o_ptr = &o_list[this_o_idx];
3414 /* Acquire next object */
3415 next_o_idx = o_ptr->next_o_idx;
3417 /* Obtain an object description */
3418 object_desc(o_name, o_ptr, 0);
3420 /* Describe the object */
3422 sprintf(out_val, "%s%s%s%s[%s]", s1, o_name, s2, s3, info);
3424 sprintf(out_val, "%s%s%s%s [%s]", s1, s2, s3, o_name, info);
3428 move_cursor_relative(y, x);
3431 /* Always stop at "normal" keys */
3432 if ((query != '\r') && (query != '\n') && (query != ' ') && (query != 'x')) return query;
3434 /* Sometimes stop at "space" key */
3435 if ((query == ' ') && !(mode & (TARGET_LOOK))) return query;
3437 /* Change the intro */
3441 s2 = "also carrying ";
3445 /* Use a preposition */
3455 #ifdef ALLOW_EASY_FLOOR
3464 char o_name[MAX_NLEN];
3468 /* Acquire object */
3469 o_ptr = &o_list[floor_list[0]];
3471 /* Describe the object */
3472 object_desc(o_name, o_ptr, 0);
3476 sprintf(out_val, "%s%s%s%s[%s]",
3477 s1, o_name, s2, s3, info);
3479 sprintf(out_val, "%s%s%s%s [%s]",
3480 s1, s2, s3, o_name, info);
3484 move_cursor_relative(y, x);
3493 /* Provide one cushion before item listing */
3496 /* Display rough information about items */
3498 sprintf(out_val, "%s %d¸Ä¤Î¥¢¥¤¥Æ¥à%s%s ['x'¤Ç°ìÍ÷, %s]",
3499 s1, floor_num, s2, s3, info);
3501 sprintf(out_val, "%s%s%sa pile of %d items [x,%s]",
3502 s1, s2, s3, floor_num, info);
3506 move_cursor_relative(y, x);
3511 /* No request for listing */
3512 if (query != 'x' && query != ' ') return query;
3516 /** Display list of items **/
3518 /* Continue scrolling list if requested */
3527 show_gold_on_floor = TRUE;
3528 (void)show_floor(0, y, x, &min_width);
3529 show_gold_on_floor = FALSE;
3533 sprintf(out_val, "%s %d¸Ä¤Î¥¢¥¤¥Æ¥à%s%s [Enter¤Ç¼¡¤Ø, %s]",
3534 s1, floor_num, s2, s3, info);
3536 sprintf(out_val, "%s%s%sa pile of %d items [Enter,%s]",
3537 s1, s2, s3, floor_num, info);
3548 /* Exit unless 'Enter' */
3549 if (query != '\n' && query != '\r')
3554 /* Get the object being moved. */
3555 o_idx = c_ptr->o_idx;
3557 /* Only rotate a pile of two or more objects. */
3558 if (!(o_idx && o_list[o_idx].next_o_idx)) continue;
3560 /* Remove the first object from the list. */
3561 excise_object_idx(o_idx);
3563 /* Find end of the list. */
3565 while (o_list[i].next_o_idx)
3566 i = o_list[i].next_o_idx;
3568 /* Add after the last object. */
3569 o_list[i].next_o_idx = o_idx;
3571 /* Loop and re-display the list */
3577 #endif /* ALLOW_EASY_FLOOR */
3580 /* Scan all objects in the grid */
3581 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
3585 /* Acquire object */
3586 o_ptr = &o_list[this_o_idx];
3588 /* Acquire next object */
3589 next_o_idx = o_ptr->next_o_idx;
3592 if (o_ptr->marked & OM_FOUND)
3594 char o_name[MAX_NLEN];
3599 /* Obtain an object description */
3600 object_desc(o_name, o_ptr, 0);
3602 /* Describe the object */
3604 sprintf(out_val, "%s%s%s%s[%s]", s1, o_name, s2, s3, info);
3606 sprintf(out_val, "%s%s%s%s [%s]", s1, s2, s3, o_name, info);
3610 move_cursor_relative(y, x);
3613 /* Always stop at "normal" keys */
3614 if ((query != '\r') && (query != '\n') && (query != ' ') && (query != 'x')) return query;
3616 /* Sometimes stop at "space" key */
3617 if ((query == ' ') && !(mode & TARGET_LOOK)) return query;
3619 /* Change the intro */
3629 if (o_ptr->number != 1) s1 = "¤½¤ì¤é¤Ï";
3631 if (o_ptr->number != 1) s1 = "They are ";
3647 /* Feature code (applying "mimic" field) */
3648 feat = get_feat_mimic(c_ptr);
3650 /* Require knowledge about grid, or ability to see grid */
3651 if (!(c_ptr->info & CAVE_MARK) && !player_can_see_bold(y, x))
3653 /* Forget feature */
3657 f_ptr = &f_info[feat];
3659 /* Terrain feature if needed */
3660 if (boring || have_flag(f_ptr->flags, FF_REMEMBER))
3664 /* Hack -- special handling for quest entrances */
3665 if (have_flag(f_ptr->flags, FF_QUEST_ENTER))
3667 /* Set the quest number temporary */
3668 int old_quest = p_ptr->inside_quest;
3671 /* Clear the text */
3672 for (j = 0; j < 10; j++) quest_text[j][0] = '\0';
3673 quest_text_line = 0;
3675 p_ptr->inside_quest = c_ptr->special;
3677 /* Get the quest text */
3678 init_flags = INIT_NAME_ONLY;
3680 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
3683 name = format("¥¯¥¨¥¹¥È¡Ö%s¡×(%d³¬ÁêÅö)", quest[c_ptr->special].name, quest[c_ptr->special].level);
3685 name = format("the entrance to the quest '%s'(level %d)", quest[c_ptr->special].name, quest[c_ptr->special].level);
3688 /* Reset the old quest number */
3689 p_ptr->inside_quest = old_quest;
3692 /* Hack -- special handling for building doors */
3693 else if (have_flag(f_ptr->flags, FF_BLDG) && !p_ptr->inside_arena)
3695 name = building[f_ptr->subtype].name;
3697 else if (have_flag(f_ptr->flags, FF_ENTRANCE))
3700 name = format("%s(%d³¬ÁêÅö)", d_text + d_info[c_ptr->special].text, d_info[c_ptr->special].mindepth);
3702 name = format("%s(level %d)", d_text + d_info[c_ptr->special].text, d_info[c_ptr->special].mindepth);
3705 else if (have_flag(f_ptr->flags, FF_TOWN))
3707 name = town[c_ptr->special].name;
3709 else if (p_ptr->wild_mode && (feat == feat_floor))
3719 name = f_name + f_ptr->name;
3725 ((!have_flag(f_ptr->flags, FF_MOVE) && !have_flag(f_ptr->flags, FF_CAN_FLY)) ||
3726 (!have_flag(f_ptr->flags, FF_LOS) && !have_flag(f_ptr->flags, FF_TREE)) ||
3727 have_flag(f_ptr->flags, FF_TOWN)))
3736 /* Hack -- special introduction for store & building doors -KMW- */
3737 if (have_flag(f_ptr->flags, FF_STORE) ||
3738 have_flag(f_ptr->flags, FF_QUEST_ENTER) ||
3739 (have_flag(f_ptr->flags, FF_BLDG) && !p_ptr->inside_arena) ||
3740 have_flag(f_ptr->flags, FF_ENTRANCE))
3749 else if (have_flag(f_ptr->flags, FF_FLOOR) ||
3750 have_flag(f_ptr->flags, FF_TOWN) ||
3751 have_flag(f_ptr->flags, FF_SHALLOW) ||
3752 have_flag(f_ptr->flags, FF_DEEP))
3758 /* Pick proper indefinite article */
3759 s3 = (is_a_vowel(name[0])) ? "an " : "a ";
3763 /* Display a message */
3767 if (c_ptr->mimic) sprintf(f_idx_str, "%d/%d", c_ptr->feat, c_ptr->mimic);
3768 else sprintf(f_idx_str, "%d", c_ptr->feat);
3770 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]);
3772 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);
3777 sprintf(out_val, "%s%s%s%s[%s]", s1, name, s2, s3, info);
3779 sprintf(out_val, "%s%s%s%s [%s]", s1, s2, s3, name, info);
3783 move_cursor_relative(y, x);
3786 /* Always stop at "normal" keys */
3787 if ((query != '\r') && (query != '\n') && (query != ' ')) return query;
3790 /* Stop on everything but "return" */
3791 if ((query != '\r') && (query != '\n')) return query;
3793 /* Repeat forever */
3799 * Handle "target" and "look".
3801 * Note that this code can be called from "get_aim_dir()".
3803 * All locations must be on the current panel. Consider the use of
3804 * "panel_bounds()" to allow "off-panel" targets, perhaps by using
3805 * some form of "scrolling" the map around the cursor. XXX XXX XXX
3806 * That is, consider the possibility of "auto-scrolling" the screen
3807 * while the cursor moves around. This may require changes in the
3808 * "update_mon()" code to allow "visibility" even if off panel, and
3809 * may require dynamic recalculation of the "temp" grid set.
3811 * Hack -- targeting/observing an "outer border grid" may induce
3812 * problems, so this is not currently allowed.
3814 * The player can use the direction keys to move among "interesting"
3815 * grids in a heuristic manner, or the "space", "+", and "-" keys to
3816 * move through the "interesting" grids in a sequential manner, or
3817 * can enter "location" mode, and use the direction keys to move one
3818 * grid at a time in any direction. The "t" (set target) command will
3819 * only target a monster (as opposed to a location) if the monster is
3820 * target_able and the "interesting" mode is being used.
3822 * The current grid is described using the "look" method above, and
3823 * a new command may be entered at any time, but note that if the
3824 * "TARGET_LOOK" bit flag is set (or if we are in "location" mode,
3825 * where "space" has no obvious meaning) then "space" will scan
3826 * through the description of the current grid until done, instead
3827 * of immediately jumping to the next "interesting" grid. This
3828 * allows the "target" command to retain its old semantics.
3830 * The "*", "+", and "-" keys may always be used to jump immediately
3831 * to the next (or previous) interesting grid, in the proper mode.
3833 * The "return" key may always be used to scan through a complete
3834 * grid description (forever).
3836 * This command will cancel any old target, even if used from
3837 * inside the "look" command.
3839 bool target_set(int mode)
3858 get_screen_size(&wid, &hgt);
3864 /* Cancel tracking */
3865 /* health_track(0); */
3868 /* Prepare the "temp" array */
3869 target_set_prepare(mode);
3871 /* Start near the player */
3877 /* Interesting grids */
3884 change_panel_xy(y, x);
3886 if (!(mode & TARGET_LOOK)) prt_path(y, x);
3889 c_ptr = &cave[y][x];
3892 if (target_able(c_ptr->m_idx))
3895 strcpy(info, "q»ß t·è p¼« o¸½ +¼¡ -Á°");
3897 strcpy(info, "q,t,p,o,+,-,<dir>");
3902 /* Dis-allow target */
3906 strcpy(info, "q»ß p¼« o¸½ +¼¡ -Á°");
3908 strcpy(info, "q,p,o,+,-,<dir>");
3913 /* Describe and Prompt */
3915 query = target_set_aux(y, x, mode, info);
3919 /* Cancel tracking */
3920 /* health_track(0); */
3922 /* Assume no "direction" */
3927 if (query == '\r') query = 't';
3945 if (target_able(c_ptr->m_idx))
3947 health_track(c_ptr->m_idx);
3948 target_who = c_ptr->m_idx;
3967 if (!expand_list) done = TRUE;
3977 if (!expand_list) done = TRUE;
3984 /* Recenter the map around the player */
3988 p_ptr->update |= (PU_MONSTERS);
3991 p_ptr->redraw |= (PR_MAP);
3994 p_ptr->window |= (PW_OVERHEAD);
3999 /* Recalculate interesting grids */
4000 target_set_prepare(mode);
4019 /* Extract the action (if any) */
4020 d = get_keymap_dir(query);
4027 /* Hack -- move around */
4030 /* Modified to scroll to monster */
4031 int y2 = panel_row_min;
4032 int x2 = panel_col_min;
4034 /* Find a new monster */
4035 i = target_pick(temp_y[m], temp_x[m], ddy[d], ddx[d]);
4037 /* Request to target past last interesting grid */
4038 while (flag && (i < 0))
4040 /* Note the change */
4041 if (change_panel(ddy[d], ddx[d]))
4046 /* Recalculate interesting grids */
4047 target_set_prepare(mode);
4049 /* Look at interesting grids */
4052 /* Find a new monster */
4053 i = target_pick(v, u, ddy[d], ddx[d]);
4059 /* Nothing interesting */
4065 /* Restore previous position */
4068 panel_bounds_center();
4071 p_ptr->update |= (PU_MONSTERS);
4074 p_ptr->redraw |= (PR_MAP);
4077 p_ptr->window |= (PW_OVERHEAD);
4082 /* Recalculate interesting grids */
4083 target_set_prepare(mode);
4085 /* Look at boring grids */
4092 /* Do not move horizontally if unnecessary */
4093 if (((x < panel_col_min + wid / 2) && (dx > 0)) ||
4094 ((x > panel_col_min + wid / 2) && (dx < 0)))
4099 /* Do not move vertically if unnecessary */
4100 if (((y < panel_row_min + hgt / 2) && (dy > 0)) ||
4101 ((y > panel_row_min + hgt / 2) && (dy < 0)))
4106 /* Apply the motion */
4107 if ((y >= panel_row_min+hgt) || (y < panel_row_min) ||
4108 (x >= panel_col_min+wid) || (x < panel_col_min))
4110 if (change_panel(dy, dx)) target_set_prepare(mode);
4113 /* Slide into legality */
4114 if (x >= cur_wid-1) x = cur_wid - 2;
4115 else if (x <= 0) x = 1;
4117 /* Slide into legality */
4118 if (y >= cur_hgt-1) y = cur_hgt- 2;
4119 else if (y <= 0) y = 1;
4128 /* Arbitrary grids */
4131 bool move_fast = FALSE;
4133 if (!(mode & TARGET_LOOK)) prt_path(y, x);
4136 c_ptr = &cave[y][x];
4138 /* Default prompt */
4140 strcpy(info, "q»ß t·è p¼« m¶á +¼¡ -Á°");
4142 strcpy(info, "q,t,p,m,+,-,<dir>");
4146 /* Describe and Prompt (enable "TARGET_LOOK") */
4147 while (!(query = target_set_aux(y, x, mode | TARGET_LOOK, info)));
4149 /* Cancel tracking */
4150 /* health_track(0); */
4152 /* Assume no direction */
4157 if (query == '\r') query = 't';
4160 /* Analyze the keypress */
4184 /* Recenter the map around the player */
4188 p_ptr->update |= (PU_MONSTERS);
4191 p_ptr->redraw |= (PR_MAP);
4194 p_ptr->window |= (PW_OVERHEAD);
4199 /* Recalculate interesting grids */
4200 target_set_prepare(mode);
4222 /* Pick a nearby monster */
4223 for (i = 0; i < temp_n; i++)
4225 t = distance(y, x, temp_y[i], temp_x[i]);
4235 /* Nothing interesting */
4236 if (bd == 999) flag = FALSE;
4243 /* Extract the action (if any) */
4244 d = get_keymap_dir(query);
4246 /* XTRA HACK MOVEFAST */
4247 if (isupper(query)) move_fast = TRUE;
4254 /* Handle "direction" */
4260 /* XTRA HACK MOVEFAST */
4263 int mag = MIN(wid / 2, hgt / 2);
4273 /* Do not move horizontally if unnecessary */
4274 if (((x < panel_col_min + wid / 2) && (dx > 0)) ||
4275 ((x > panel_col_min + wid / 2) && (dx < 0)))
4280 /* Do not move vertically if unnecessary */
4281 if (((y < panel_row_min + hgt / 2) && (dy > 0)) ||
4282 ((y > panel_row_min + hgt / 2) && (dy < 0)))
4287 /* Apply the motion */
4288 if ((y >= panel_row_min + hgt) || (y < panel_row_min) ||
4289 (x >= panel_col_min + wid) || (x < panel_col_min))
4291 if (change_panel(dy, dx)) target_set_prepare(mode);
4294 /* Slide into legality */
4295 if (x >= cur_wid-1) x = cur_wid - 2;
4296 else if (x <= 0) x = 1;
4298 /* Slide into legality */
4299 if (y >= cur_hgt-1) y = cur_hgt- 2;
4300 else if (y <= 0) y = 1;
4308 /* Clear the top line */
4311 /* Recenter the map around the player */
4315 p_ptr->update |= (PU_MONSTERS);
4318 p_ptr->redraw |= (PR_MAP);
4321 p_ptr->window |= (PW_OVERHEAD);
4326 /* Failure to set target */
4327 if (!target_who) return (FALSE);
4335 * Get an "aiming direction" from the user.
4337 * The "dir" is loaded with 1,2,3,4,6,7,8,9 for "actual direction", and
4338 * "0" for "current target", and "-1" for "entry aborted".
4340 * Note that "Force Target", if set, will pre-empt user interaction,
4341 * if there is a usable target already set.
4343 * Note that confusion over-rides any (explicit?) user choice.
4345 bool get_aim_dir(int *dp)
4356 /* Global direction */
4359 /* Hack -- auto-target if requested */
4360 if (use_old_target && target_okay()) dir = 5;
4362 #ifdef ALLOW_REPEAT /* TNB */
4364 if (repeat_pull(dp))
4369 if (!(*dp == 5 && !target_okay()))
4371 /* return (TRUE); */
4376 #endif /* ALLOW_REPEAT -- TNB */
4378 /* Ask until satisfied */
4381 /* Choose a prompt */
4385 p = "Êý¸þ ('*'¤Ç¥¿¡¼¥²¥Ã¥ÈÁªÂò, ESC¤ÇÃæÃÇ)? ";
4387 p = "Direction ('*' to choose a target, Escape to cancel)? ";
4394 p = "Êý¸þ ('5'¤Ç¥¿¡¼¥²¥Ã¥È¤Ø, '*'¤Ç¥¿¡¼¥²¥Ã¥ÈºÆÁªÂò, ESC¤ÇÃæÃÇ)? ";
4396 p = "Direction ('5' for target, '*' to re-target, Escape to cancel)? ";
4401 /* Get a command (or Cancel) */
4402 if (!get_com(p, &command, TRUE)) break;
4406 if (command == '\r') command = 't';
4409 /* Convert various keys to "standard" keys */
4412 /* Use current target */
4423 /* Set new target */
4428 if (target_set(TARGET_KILL)) dir = 5;
4434 /* Extract the action (if any) */
4435 dir = get_keymap_dir(command);
4441 /* Verify requested targets */
4442 if ((dir == 5) && !target_okay()) dir = 0;
4451 project_length = 0; /* reset to default */
4455 /* Save the direction */
4458 /* Check for confusion */
4459 if (p_ptr->confused)
4462 /* Random direction */
4463 dir = ddd[randint0(8)];
4466 /* Notice confusion */
4467 if (command_dir != dir)
4471 msg_print("¤¢¤Ê¤¿¤Ïº®Í𤷤Ƥ¤¤ë¡£");
4473 msg_print("You are confused.");
4478 /* Save direction */
4481 #ifdef ALLOW_REPEAT /* TNB */
4483 /* repeat_push(dir); */
4484 repeat_push(command_dir);
4486 #endif /* ALLOW_REPEAT -- TNB */
4488 /* A "valid" direction was entered */
4495 * Request a "movement" direction (1,2,3,4,6,7,8,9) from the user,
4496 * and place it into "command_dir", unless we already have one.
4498 * This function should be used for all "repeatable" commands, such as
4499 * run, walk, open, close, bash, disarm, spike, tunnel, etc, as well
4500 * as all commands which must reference a grid adjacent to the player,
4501 * and which may not reference the grid under the player. Note that,
4502 * for example, it is no longer possible to "disarm" or "open" chests
4503 * in the same grid as the player.
4505 * Direction "5" is illegal and will (cleanly) abort the command.
4507 * This function tracks and uses the "global direction", and uses
4508 * that as the "desired direction", to which "confusion" is applied.
4510 bool get_rep_dir(int *dp, bool under)
4518 /* Global direction */
4521 #ifdef ALLOW_REPEAT /* TNB */
4523 if (repeat_pull(dp))
4526 /* return (TRUE); */
4529 #endif /* ALLOW_REPEAT -- TNB */
4533 prompt = _("Êý¸þ ('.'¸µ, ESC¤ÇÃæÃÇ)? ", "Direction ('.' at feet, Escape to cancel)? ");
4537 prompt = _("Êý¸þ (ESC¤ÇÃæÃÇ)? ", "Direction (Escape to cancel)? ");
4540 /* Get a direction */
4545 /* Get a command (or Cancel) */
4546 if (!get_com(prompt, &ch, TRUE)) break;
4549 if ((under) && ((ch == '5') || (ch == '-') || (ch == '.')))
4555 /* Look up the direction */
4556 dir = get_keymap_dir(ch);
4563 /* Prevent weirdness */
4564 if ((dir == 5) && (!under)) dir = 0;
4567 if (!dir) return (FALSE);
4569 /* Save desired direction */
4572 /* Apply "confusion" */
4573 if (p_ptr->confused)
4575 /* Standard confusion */
4576 if (randint0(100) < 75)
4578 /* Random direction */
4579 dir = ddd[randint0(8)];
4582 else if (p_ptr->riding)
4584 monster_type *m_ptr = &m_list[p_ptr->riding];
4585 monster_race *r_ptr = &r_info[m_ptr->r_idx];
4587 if (MON_CONFUSED(m_ptr))
4589 /* Standard confusion */
4590 if (randint0(100) < 75)
4592 /* Random direction */
4593 dir = ddd[randint0(8)];
4596 else if ((r_ptr->flags1 & RF1_RAND_50) && (r_ptr->flags1 & RF1_RAND_25) && (randint0(100) < 50))
4598 /* Random direction */
4599 dir = ddd[randint0(8)];
4601 else if ((r_ptr->flags1 & RF1_RAND_50) && (randint0(100) < 25))
4603 /* Random direction */
4604 dir = ddd[randint0(8)];
4608 /* Notice confusion */
4609 if (command_dir != dir)
4611 if (p_ptr->confused)
4615 msg_print("¤¢¤Ê¤¿¤Ïº®Í𤷤Ƥ¤¤ë¡£");
4617 msg_print("You are confused.");
4623 monster_type *m_ptr = &m_list[p_ptr->riding];
4625 monster_desc(m_name, m_ptr, 0);
4626 if (MON_CONFUSED(m_ptr))
4629 msg_format("%s¤Ïº®Í𤷤Ƥ¤¤ë¡£", m_name);
4631 msg_format("%^s is confusing.", m_name);
4638 msg_format("%s¤Ï»×¤¤Ä̤ê¤ËÆ°¤¤¤Æ¤¯¤ì¤Ê¤¤¡£", m_name);
4640 msg_format("You cannot control %s.", m_name);
4646 /* Save direction */
4649 #ifdef ALLOW_REPEAT /* TNB */
4651 /* repeat_push(dir); */
4652 repeat_push(command_dir);
4654 #endif /* ALLOW_REPEAT -- TNB */
4661 bool get_rep_dir2(int *dp)
4668 /* Global direction */
4671 #ifdef ALLOW_REPEAT /* TNB */
4673 if (repeat_pull(dp))
4676 /* return (TRUE); */
4679 #endif /* ALLOW_REPEAT -- TNB */
4681 /* Get a direction */
4686 /* Get a command (or Cancel) */
4688 if (!get_com("Êý¸þ (ESC¤ÇÃæÃÇ)? ", &ch, TRUE)) break;
4690 if (!get_com("Direction (Escape to cancel)? ", &ch, TRUE)) break;
4694 /* Look up the direction */
4695 dir = get_keymap_dir(ch);
4701 /* Prevent weirdness */
4702 if (dir == 5) dir = 0;
4705 if (!dir) return (FALSE);
4707 /* Save desired direction */
4710 /* Apply "confusion" */
4711 if (p_ptr->confused)
4713 /* Standard confusion */
4714 if (randint0(100) < 75)
4716 /* Random direction */
4717 dir = ddd[randint0(8)];
4721 /* Notice confusion */
4722 if (command_dir != dir)
4726 msg_print("¤¢¤Ê¤¿¤Ïº®Í𤷤Ƥ¤¤ë¡£");
4728 msg_print("You are confused.");
4733 /* Save direction */
4736 #ifdef ALLOW_REPEAT /* TNB */
4738 /* repeat_push(dir); */
4739 repeat_push(command_dir);
4741 #endif /* ALLOW_REPEAT -- TNB */
4747 void gain_level_reward(int chosen_reward)
4751 char wrath_reason[32] = "";
4752 int nasty_chance = 6;
4753 int dummy = 0, dummy2 = 0;
4756 char o_name[MAX_NLEN];
4762 if (multi_rew) return;
4763 else multi_rew = TRUE;
4767 if (p_ptr->lev == 13) nasty_chance = 2;
4768 else if (!(p_ptr->lev % 13)) nasty_chance = 3;
4769 else if (!(p_ptr->lev % 14)) nasty_chance = 12;
4771 if (one_in_(nasty_chance))
4772 type = randint1(20); /* Allow the 'nasty' effects */
4774 type = randint1(15) + 5; /* Or disallow them */
4776 if (type < 1) type = 1;
4777 if (type > 20) type = 20;
4782 sprintf(wrath_reason, "%s¤ÎÅܤê",
4783 chaos_patrons[p_ptr->chaos_patron]);
4785 sprintf(wrath_reason, "the Wrath of %s",
4786 chaos_patrons[p_ptr->chaos_patron]);
4790 effect = chaos_rewards[p_ptr->chaos_patron][type];
4792 if (one_in_(6) && !chosen_reward)
4795 msg_format("%^s¤ÏË«Èþ¤È¤·¤Æ¤¢¤Ê¤¿¤òÆÍÁ³ÊÑ°Û¤µ¤»¤¿¡£",
4796 chaos_patrons[p_ptr->chaos_patron]);
4798 msg_format("%^s rewards you with a mutation!",
4799 chaos_patrons[p_ptr->chaos_patron]);
4802 (void)gain_random_mutation(0);
4804 reward = "ÊÑ°Û¤·¤¿¡£";
4806 reward = "mutation";
4811 switch (chosen_reward ? chosen_reward : effect)
4815 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
4816 chaos_patrons[p_ptr->chaos_patron]);
4818 msg_format("The voice of %s booms out:",
4819 chaos_patrons[p_ptr->chaos_patron]);
4823 msg_print("¡ÖÆò¡¢¿·¤¿¤Ê¤ë»Ñ¤òɬÍפȤ»¤ê¡ª¡×");
4825 msg_print("'Thou needst a new form, mortal!'");
4830 reward = "ÊÑ°Û¤·¤¿¡£";
4832 reward = "polymorphing";
4837 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
4838 chaos_patrons[p_ptr->chaos_patron]);
4840 msg_format("The voice of %s booms out:",
4841 chaos_patrons[p_ptr->chaos_patron]);
4845 msg_print("¡ÖÆò¤ÏÎɤ¯¹Ô¤¤¤¿¤ê¡ªÂ³¤±¤è¡ª¡×");
4847 msg_print("'Well done, mortal! Lead on!'");
4850 if (p_ptr->prace == RACE_ANDROID)
4853 msg_print("¤·¤«¤·²¿¤âµ¯¤³¤é¤Ê¤«¤Ã¤¿¡£");
4855 msg_print("But, nothing happen.");
4858 else if (p_ptr->exp < PY_MAX_EXP)
4860 s32b ee = (p_ptr->exp / 2) + 10;
4861 if (ee > 100000L) ee = 100000L;
4863 msg_print("¹¹¤Ë·Ð¸³¤òÀѤó¤À¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£");
4865 msg_print("You feel more experienced.");
4870 reward = "·Ð¸³ÃͤòÆÀ¤¿";
4872 reward = "experience";
4878 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
4879 chaos_patrons[p_ptr->chaos_patron]);
4881 msg_format("The voice of %s booms out:",
4882 chaos_patrons[p_ptr->chaos_patron]);
4886 msg_print("¡Ö²¼Ëͤ衢Æò¤½¤ì¤ËÃͤ»¤º¡£¡×");
4888 msg_print("'Thou didst not deserve that, slave.'");
4891 if (p_ptr->prace == RACE_ANDROID)
4894 msg_print("¤·¤«¤·²¿¤âµ¯¤³¤é¤Ê¤«¤Ã¤¿¡£");
4896 msg_print("But, nothing happen.");
4901 lose_exp(p_ptr->exp / 6);
4903 reward = "·Ð¸³Ãͤò¼º¤Ã¤¿¡£";
4905 reward = "losing experience";
4911 msg_format("%s¤ÎÀ¼¤¬¤µ¤µ¤ä¤¤¤¿:",
4912 chaos_patrons[p_ptr->chaos_patron]);
4914 msg_format("The voice of %s whispers:",
4915 chaos_patrons[p_ptr->chaos_patron]);
4919 msg_print("¡Ö²æ¤¬Í¿¤¨¤·Êª¤ò¸ÌÀ¤Ë»È¤¦¤Ù¤·¡£¡×");
4921 msg_print("'Use my gift wisely.'");
4924 acquirement(py, px, 1, FALSE, FALSE);
4926 reward = "¾å¼Á¤Ê¥¢¥¤¥Æ¥à¤ò¼ê¤ËÆþ¤ì¤¿¡£";
4928 reward = "a good item";
4933 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
4934 chaos_patrons[p_ptr->chaos_patron]);
4936 msg_format("The voice of %s booms out:",
4937 chaos_patrons[p_ptr->chaos_patron]);
4941 msg_print("¡Ö²æ¤¬Í¿¤¨¤·Êª¤ò¸ÌÀ¤Ë»È¤¦¤Ù¤·¡£¡×");
4943 msg_print("'Use my gift wisely.'");
4946 acquirement(py, px, 1, TRUE, FALSE);
4948 reward = "¹âµéÉʤΥ¢¥¤¥Æ¥à¤ò¼ê¤ËÆþ¤ì¤¿¡£";
4950 reward = "an excellent item";
4955 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
4956 chaos_patrons[p_ptr->chaos_patron]);
4958 msg_format("The voice of %s booms out:",
4959 chaos_patrons[p_ptr->chaos_patron]);
4963 msg_print("¡ÖÆò¤Î¹Ô¤¤¤Ïµ®¤·õ¤ËÃͤ»¤ê¡£¡×");
4965 msg_print("'Thy deed hath earned thee a worthy blade.'");
4968 /* Get local object */
4971 switch (randint1(p_ptr->lev))
4977 dummy2 = SV_MAIN_GAUCHE;
4986 dummy2 = SV_SMALL_SWORD;
4989 dummy2 = SV_BASILLARD;
4991 case 11: case 12: case 13:
4992 dummy2 = SV_SHORT_SWORD;
4998 dummy2 = SV_CUTLASS;
5001 dummy2 = SV_WAKIZASHI;
5004 dummy2 = SV_KHOPESH;
5010 dummy2 = SV_BROAD_SWORD;
5013 dummy2 = SV_LONG_SWORD;
5016 dummy2 = SV_SCIMITAR;
5019 dummy2 = SV_NINJATO;
5025 dummy2 = SV_BASTARD_SWORD;
5028 dummy2 = SV_GREAT_SCIMITAR;
5031 dummy2 = SV_CLAYMORE;
5034 dummy2 = SV_ESPADON;
5037 dummy2 = SV_TWO_HANDED_SWORD;
5040 dummy2 = SV_FLAMBERGE;
5043 dummy2 = SV_NO_DACHI;
5046 dummy2 = SV_EXECUTIONERS_SWORD;
5049 dummy2 = SV_ZWEIHANDER;
5052 dummy2 = SV_HAYABUSA;
5055 dummy2 = SV_BLADE_OF_CHAOS;
5058 object_prep(q_ptr, lookup_kind(dummy, dummy2));
5059 q_ptr->to_h = 3 + randint1(dun_level) % 10;
5060 q_ptr->to_d = 3 + randint1(dun_level) % 10;
5061 one_resistance(q_ptr);
5062 q_ptr->name2 = EGO_CHAOTIC;
5064 /* Drop it in the dungeon */
5065 (void)drop_near(q_ptr, -1, py, px);
5067 reward = "(º®ÆÙ)¤ÎÉð´ï¤ò¼ê¤ËÆþ¤ì¤¿¡£";
5069 reward = "chaos weapon";
5074 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5075 chaos_patrons[p_ptr->chaos_patron]);
5077 msg_format("The voice of %s booms out:",
5078 chaos_patrons[p_ptr->chaos_patron]);
5082 msg_print("¡ÖÆò¤Î¹Ô¤¤¤Ïµ®¤Ê󤤤ËÃͤ»¤ê¡£¡×");
5084 msg_print("'Thy deed hath earned thee a worthy reward.'");
5087 acquirement(py, px, randint1(2) + 1, FALSE, FALSE);
5089 reward = "¾å¼Á¤Ê¥¢¥¤¥Æ¥à¤ò¼ê¤ËÆþ¤ì¤¿¡£";
5091 reward = "good items";
5096 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5097 chaos_patrons[p_ptr->chaos_patron]);
5099 msg_format("The voice of %s booms out:",
5100 chaos_patrons[p_ptr->chaos_patron]);
5104 msg_print("¡Ö²¼Ëͤ衢Æò¤Î¸¥¿È¤Ø¤Î²æ¤¬Àˤ·¤ß̵¤Ê󤤤ò¸«¤ë¤¬¤è¤¤¡£¡×");
5106 msg_print("'Behold, mortal, how generously I reward thy loyalty.'");
5109 acquirement(py, px, randint1(2) + 1, TRUE, FALSE);
5111 reward = "¹âµéÉʤΥ¢¥¤¥Æ¥à¤ò¼ê¤ËÆþ¤ì¤¿¡£";
5113 reward = "excellent items";
5118 msg_format("%s¤ÎÀ¼¤¬¹ì¤ÅϤä¿:",
5119 chaos_patrons[p_ptr->chaos_patron]);
5121 msg_format("The voice of %s thunders:",
5122 chaos_patrons[p_ptr->chaos_patron]);
5126 msg_print("¡Ö²¼Ëͤ衢ÆòÐþËý¤Ê¤ê¡£¡×");
5128 msg_print("'Thou art growing arrogant, mortal.'");
5131 (void)activate_ty_curse(FALSE, &count);
5133 reward = "²Ò¡¹¤·¤¤¼ö¤¤¤ò¤«¤±¤é¤ì¤¿¡£";
5140 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5141 chaos_patrons[p_ptr->chaos_patron]);
5143 msg_format("The voice of %s booms out:",
5144 chaos_patrons[p_ptr->chaos_patron]);
5148 msg_print("¡Ö²æ¤¬²¼Ëͤ¿¤Á¤è¡¢¤«¤ÎÐþËý¤Ê¤ë¼Ô¤òÅݤ¹¤Ù¤·¡ª¡×");
5150 msg_print("'My pets, destroy the arrogant mortal!'");
5153 for (dummy = 0; dummy < randint1(5) + 1; dummy++)
5155 (void)summon_specific(0, py, px, dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
5158 reward = "¥â¥ó¥¹¥¿¡¼¤ò¾¤´¤µ¤ì¤¿¡£";
5160 reward = "summoning hostile monsters";
5165 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5166 chaos_patrons[p_ptr->chaos_patron]);
5168 msg_format("The voice of %s booms out:",
5169 chaos_patrons[p_ptr->chaos_patron]);
5173 msg_print("¡ÖÆò¡¢¤è¤ê¶¯¤Å¨¤òɬÍפȤ»¤ê¡ª¡×");
5175 msg_print("'Thou needst worthier opponents!'");
5178 activate_hi_summon(py, px, FALSE);
5180 reward = "¥â¥ó¥¹¥¿¡¼¤ò¾¤´¤µ¤ì¤¿¡£";
5182 reward = "summoning many hostile monsters";
5187 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5188 chaos_patrons[p_ptr->chaos_patron]);
5190 msg_format("The voice of %s booms out:",
5191 chaos_patrons[p_ptr->chaos_patron]);
5195 msg_print("¡Ö»à¤ÈÇ˲õ¤³¤½²æ¤¬´î¤Ó¤Ê¤ê¡ª¡×");
5197 msg_print("'Death and destruction! This pleaseth me!'");
5202 reward = "¥«¥ª¥¹¤ÎÎϤ¬±²´¬¤¤¤¿¡£";
5204 reward = "calling chaos";
5209 msg_format("%s¤ÎÀ¼¤¬ÌĤê¶Á¤¤¤¿:",
5210 chaos_patrons[p_ptr->chaos_patron]);
5212 msg_format("The voice of %s rings out:",
5213 chaos_patrons[p_ptr->chaos_patron]);
5217 msg_print("¡Öα¤Þ¤ë¤Î¤À¡¢²¼Ëͤ衣;¤¬Æò¤ÎÆùÂΤòÃ䨤󡣡×");
5219 msg_print("'Stay, mortal, and let me mold thee.'");
5222 if (one_in_(3) && !(chaos_stats[p_ptr->chaos_patron] < 0))
5223 do_inc_stat(chaos_stats[p_ptr->chaos_patron]);
5225 do_inc_stat(randint0(6));
5227 reward = "ǽÎÏÃͤ¬¾å¤¬¤Ã¤¿¡£";
5229 reward = "increasing a stat";
5234 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5235 chaos_patrons[p_ptr->chaos_patron]);
5237 msg_format("The voice of %s booms out:",
5238 chaos_patrons[p_ptr->chaos_patron]);
5242 msg_print("¡Ö²¼Ëͤ衢;¤ÏÆò¤ËË°¤ß¤¿¤ê¡£¡×");
5244 msg_print("'I grow tired of thee, mortal.'");
5247 if (one_in_(3) && !(chaos_stats[p_ptr->chaos_patron] < 0))
5248 do_dec_stat(chaos_stats[p_ptr->chaos_patron]);
5250 (void)do_dec_stat(randint0(6));
5252 reward = "ǽÎÏÃͤ¬²¼¤¬¤Ã¤¿¡£";
5254 reward = "decreasing a stat";
5259 msg_format("%s¤ÎÀ¼¤¬¹ì¤ÅϤä¿:",
5260 chaos_patrons[p_ptr->chaos_patron]);
5262 msg_format("The voice of %s thunders:",
5263 chaos_patrons[p_ptr->chaos_patron]);
5267 msg_print("¡ÖÆò¡¢¸¬µõ¤¿¤ë¤³¤È¤ò³Ø¤Ö¤Ù¤·¡ª¡×");
5268 msg_print("¤¢¤Ê¤¿¤Ï°ÊÁ°¤è¤ê¼å¤¯¤Ê¤Ã¤¿¡ª");
5270 msg_print("'Thou needst a lesson in humility, mortal!'");
5271 msg_print("You feel less powerful!");
5274 for (dummy = 0; dummy < 6; dummy++)
5276 (void)dec_stat(dummy, 10 + randint1(15), TRUE);
5279 reward = "Á´Ç½ÎÏÃͤ¬²¼¤¬¤Ã¤¿¡£";
5281 reward = "decreasing all stats";
5286 msg_format("%s¤ÎÎϤ¬¿¨¤ì¤ë¤Î¤ò´¶¤¸¤¿¡£",
5288 msg_format("You feel the power of %s touch you.",
5291 chaos_patrons[p_ptr->chaos_patron]);
5294 reward = "½ý¤¬ÊѲ½¤·¤¿¡£";
5296 reward = "polymorphing wounds";
5301 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5302 chaos_patrons[p_ptr->chaos_patron]);
5304 msg_format("The voice of %s booms out:",
5305 chaos_patrons[p_ptr->chaos_patron]);
5309 msg_print("¡Ö²æ¤¬¤µ¤µ¤ä¤«¤Ê¤ë»òʪ¤ò¼õ¤±¤È¤ë¤¬¤è¤¤¡ª¡×");
5311 msg_print("'Receive this modest gift from me!'");
5314 for (dummy = 0; dummy < 6; dummy++)
5316 (void)do_inc_stat(dummy);
5319 reward = "Á´Ç½ÎÏÃͤ¬¾å¤¬¤Ã¤¿¡£";
5321 reward = "increasing all stats";
5326 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5327 chaos_patrons[p_ptr->chaos_patron]);
5329 msg_format("The voice of %s booms out:",
5330 chaos_patrons[p_ptr->chaos_patron]);
5334 msg_print("¡Ö¶ì¤·¤à¤¬¤è¤¤¡¢ÌµÇ½¤Ê¶ò¤«¼Ô¤è¡ª¡×");
5336 msg_print("'Suffer, pathetic fool!'");
5339 fire_ball(GF_DISINTEGRATE, 0, p_ptr->lev * 4, 4);
5340 take_hit(DAMAGE_NOESCAPE, p_ptr->lev * 4, wrath_reason, -1);
5342 reward = "ʬ²ò¤Îµå¤¬È¯À¸¤·¤¿¡£";
5344 reward = "generating disintegration ball";
5349 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5350 chaos_patrons[p_ptr->chaos_patron]);
5352 msg_format("The voice of %s booms out:",
5353 chaos_patrons[p_ptr->chaos_patron]);
5357 msg_print("¡Öᴤ뤬¤è¤¤¡¢²æ¤¬²¼Ëͤ衪¡×");
5359 msg_print("'Rise, my servant!'");
5363 (void)set_poisoned(0);
5365 (void)set_confused(0);
5370 for (dummy = 0; dummy < 6; dummy++)
5372 (void)do_res_stat(dummy);
5375 reward = "ÂÎÎϤ¬²óÉü¤·¤¿¡£";
5381 if (!buki_motteruka(INVEN_RARM) && !buki_motteruka(INVEN_LARM)) break;
5383 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5384 chaos_patrons[p_ptr->chaos_patron]);
5386 msg_format("The voice of %s booms out:",
5387 chaos_patrons[p_ptr->chaos_patron]);
5391 msg_print("¡ÖÆò¡¢Éð´ï¤ËÍê¤ë¤³¤È¤Ê¤«¤ì¡£¡×");
5393 msg_print("'Thou reliest too much on thy weapon.'");
5397 if (buki_motteruka(INVEN_LARM))
5400 if (buki_motteruka(INVEN_RARM) && one_in_(2)) dummy = INVEN_RARM;
5402 object_desc(o_name, &inventory[dummy], OD_NAME_ONLY);
5403 (void)curse_weapon(FALSE, dummy);
5405 reward = format("%s¤¬Ç˲õ¤µ¤ì¤¿¡£", o_name);
5407 reward = format("destroying %s", o_name);
5411 if (!inventory[INVEN_BODY].k_idx) break;
5413 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5414 chaos_patrons[p_ptr->chaos_patron]);
5416 msg_format("The voice of %s booms out:",
5417 chaos_patrons[p_ptr->chaos_patron]);
5421 msg_print("¡ÖÆò¡¢Ëɶñ¤ËÍê¤ë¤³¤È¤Ê¤«¤ì¡£¡×");
5423 msg_print("'Thou reliest too much on thine equipment.'");
5426 object_desc(o_name, &inventory[INVEN_BODY], OD_NAME_ONLY);
5427 (void)curse_armor();
5429 reward = format("%s¤¬Ç˲õ¤µ¤ì¤¿¡£", o_name);
5431 reward = format("destroying %s", o_name);
5436 msg_format("%s¤ÎÀ¼¤¬¤µ¤µ¤ä¤¤¤¿:",
5437 chaos_patrons[p_ptr->chaos_patron]);
5439 msg_format("The voice of %s whispers:",
5440 chaos_patrons[p_ptr->chaos_patron]);
5444 msg_print("¡Ö²æ¤òÅܤꤷ¤á¤¿ºá¤ò½þ¤¦¤Ù¤·¡£¡×");
5446 msg_print("'Now thou shalt pay for annoying me.'");
5449 switch (randint1(4))
5452 (void)activate_ty_curse(FALSE, &count);
5454 reward = "²Ò¡¹¤·¤¤¼ö¤¤¤ò¤«¤±¤é¤ì¤¿¡£";
5460 activate_hi_summon(py, px, FALSE);
5462 reward = "¥â¥ó¥¹¥¿¡¼¤ò¾¤´¤µ¤ì¤¿¡£";
5464 reward = "summoning hostile monsters";
5470 if (!buki_motteruka(INVEN_RARM) && !buki_motteruka(INVEN_LARM)) break;
5472 if (buki_motteruka(INVEN_LARM))
5475 if (buki_motteruka(INVEN_RARM) && one_in_(2)) dummy = INVEN_RARM;
5477 object_desc(o_name, &inventory[dummy], OD_NAME_ONLY);
5478 (void)curse_weapon(FALSE, dummy);
5480 reward = format("%s¤¬Ç˲õ¤µ¤ì¤¿¡£", o_name);
5482 reward = format("destroying %s", o_name);
5487 if (!inventory[INVEN_BODY].k_idx) break;
5488 object_desc(o_name, &inventory[INVEN_BODY], OD_NAME_ONLY);
5489 (void)curse_armor();
5491 reward = format("%s¤¬Ç˲õ¤µ¤ì¤¿¡£", o_name);
5493 reward = format("destroying %s", o_name);
5498 for (dummy = 0; dummy < 6; dummy++)
5500 (void)dec_stat(dummy, 10 + randint1(15), TRUE);
5503 reward = "Á´Ç½ÎÏÃͤ¬²¼¤¬¤Ã¤¿¡£";
5505 reward = "decreasing all stats";
5512 msg_format("%s¤ÎÀ¼¤¬¹ì¤ÅϤä¿:",
5514 msg_format("The voice of %s thunders:",
5517 chaos_patrons[p_ptr->chaos_patron]);
5519 msg_print("¡Ö»à¤Ì¤¬¤è¤¤¡¢²¼Ëͤ衪¡×");
5521 msg_print("'Die, mortal!'");
5524 take_hit(DAMAGE_LOSELIFE, p_ptr->lev * 4, wrath_reason, -1);
5525 for (dummy = 0; dummy < 6; dummy++)
5527 (void)dec_stat(dummy, 10 + randint1(15), FALSE);
5529 activate_hi_summon(py, px, FALSE);
5530 (void)activate_ty_curse(FALSE, &count);
5535 if (buki_motteruka(INVEN_RARM))
5538 if (buki_motteruka(INVEN_LARM) && one_in_(2)) dummy = INVEN_LARM;
5540 else if (buki_motteruka(INVEN_LARM)) dummy = INVEN_LARM;
5542 if (dummy) (void)curse_weapon(FALSE, dummy);
5544 if (one_in_(2)) (void)curse_armor();
5548 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5549 chaos_patrons[p_ptr->chaos_patron]);
5551 msg_format("The voice of %s booms out:",
5552 chaos_patrons[p_ptr->chaos_patron]);
5556 msg_print("¡Ö»à¤ÈÇ˲õ¤³¤½²æ¤¬´î¤Ó¤Ê¤ê¡ª¡×");
5558 msg_print("'Death and destruction! This pleaseth me!'");
5561 (void)destroy_area(py, px, 25, FALSE);
5563 reward = "¥À¥ó¥¸¥ç¥ó¤¬*Ç˲õ*¤µ¤ì¤¿¡£";
5565 reward = "*destruct*ing dungeon";
5570 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5571 chaos_patrons[p_ptr->chaos_patron]);
5573 msg_format("The voice of %s booms out:",
5574 chaos_patrons[p_ptr->chaos_patron]);
5578 msg_print("¡Ö²æ¡¢Æò¤ÎŨ¤òËõ»¦¤»¤ó¡ª¡×");
5580 msg_print("'Let me relieve thee of thine oppressors!'");
5583 (void)symbol_genocide(0, FALSE);
5585 reward = "¥â¥ó¥¹¥¿¡¼¤¬Ëõ»¦¤µ¤ì¤¿¡£";
5587 reward = "genociding monsters";
5592 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5593 chaos_patrons[p_ptr->chaos_patron]);
5595 msg_format("The voice of %s booms out:",
5596 chaos_patrons[p_ptr->chaos_patron]);
5600 msg_print("¡Ö²æ¡¢Æò¤ÎŨ¤òËõ»¦¤»¤ó¡ª¡×");
5602 msg_print("'Let me relieve thee of thine oppressors!'");
5605 (void)mass_genocide(0, FALSE);
5607 reward = "¥â¥ó¥¹¥¿¡¼¤¬Ëõ»¦¤µ¤ì¤¿¡£";
5609 reward = "genociding nearby monsters";
5614 msg_format("%s¤ÎÎϤ¬Å¨¤ò¹¶·â¤¹¤ë¤Î¤ò´¶¤¸¤¿¡ª",
5615 chaos_patrons[p_ptr->chaos_patron]);
5617 msg_format("You can feel the power of %s assault your enemies!",
5618 chaos_patrons[p_ptr->chaos_patron]);
5621 (void)dispel_monsters(p_ptr->lev * 4);
5625 msg_format("%s¤Ï¤¢¤Ê¤¿¤ò̵»ë¤·¤¿¡£",
5626 chaos_patrons[p_ptr->chaos_patron]);
5628 msg_format("%s ignores you.",
5629 chaos_patrons[p_ptr->chaos_patron]);
5635 msg_format("%s¤ÏË«Èþ¤È¤·¤Æ°Ëâ¤Î»È¤¤¤ò¤è¤³¤·¤¿¡ª",chaos_patrons[p_ptr->chaos_patron]);
5637 msg_format("%s rewards you with a demonic servant!",chaos_patrons[p_ptr->chaos_patron]);
5640 if (!summon_specific(-1, py, px, dun_level, SUMMON_DEMON, PM_FORCE_PET))
5642 msg_print("²¿¤â¸½¤ì¤Ê¤«¤Ã¤¿...");
5644 msg_print("Nobody ever turns up...");
5648 reward = "°Ë⤬¥Ú¥Ã¥È¤Ë¤Ê¤Ã¤¿¡£";
5650 reward = "a demonic servant";
5656 msg_format("%s¤ÏË«Èþ¤È¤·¤Æ»È¤¤¤ò¤è¤³¤·¤¿¡ª",chaos_patrons[p_ptr->chaos_patron]);
5658 msg_format("%s rewards you with a servant!",chaos_patrons[p_ptr->chaos_patron]);
5661 if (!summon_specific(-1, py, px, dun_level, 0, PM_FORCE_PET))
5663 msg_print("²¿¤â¸½¤ì¤Ê¤«¤Ã¤¿...");
5665 msg_print("Nobody ever turns up...");
5669 reward = "¥â¥ó¥¹¥¿¡¼¤¬¥Ú¥Ã¥È¤Ë¤Ê¤Ã¤¿¡£";
5671 reward = "a servant";
5677 msg_format("%s¤ÏË«Èþ¤È¤·¤Æ¥¢¥ó¥Ç¥Ã¥É¤Î»È¤¤¤ò¤è¤³¤·¤¿¡£",chaos_patrons[p_ptr->chaos_patron]);
5679 msg_format("%s rewards you with an undead servant!",chaos_patrons[p_ptr->chaos_patron]);
5682 if (!summon_specific(-1, py, px, dun_level, SUMMON_UNDEAD, PM_FORCE_PET))
5684 msg_print("²¿¤â¸½¤ì¤Ê¤«¤Ã¤¿...");
5686 msg_print("Nobody ever turns up...");
5690 reward = "¥¢¥ó¥Ç¥Ã¥É¤¬¥Ú¥Ã¥È¤Ë¤Ê¤Ã¤¿¡£";
5692 reward = "an undead servant";
5698 msg_format("%s¤ÎÀ¼¤¬¤É¤â¤Ã¤¿:",
5700 msg_format("The voice of %s stammers:",
5703 chaos_patrons[p_ptr->chaos_patron]);
5705 msg_format("¡Ö¤¢¡¼¡¢¤¢¡¼¡¢Åú¤¨¤Ï %d/%d¡£¼ÁÌä¤Ï²¿¡©¡×", type, effect);
5707 msg_format("'Uh... uh... the answer's %d/%d, what's the question?'", type, effect);
5715 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, format("¥Ñ¥È¥í¥ó¤ÎÊó½·¤Ç%s", reward));
5717 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, format("The patron rewards you with %s.", reward));
5724 * XAngband: determine if a given location is "interesting"
5725 * based on target_set_accept function.
5727 static bool tgt_pt_accept(int y, int x)
5732 if (!(in_bounds(y, x))) return (FALSE);
5734 /* Player grid is always interesting */
5735 if ((y == py) && (x == px)) return (TRUE);
5737 /* Handle hallucination */
5738 if (p_ptr->image) return (FALSE);
5740 /* Examine the grid */
5741 c_ptr = &cave[y][x];
5743 /* Interesting memorized features */
5744 if (c_ptr->info & (CAVE_MARK))
5747 if (cave_have_flag_grid(c_ptr, FF_LESS)) return (TRUE);
5748 if (cave_have_flag_grid(c_ptr, FF_MORE)) return (TRUE);
5750 /* Notice quest features */
5751 if (cave_have_flag_grid(c_ptr, FF_QUEST_ENTER)) return (TRUE);
5752 if (cave_have_flag_grid(c_ptr, FF_QUEST_EXIT)) return (TRUE);
5761 * XAngband: Prepare the "temp" array for "tget_pt"
5762 * based on target_set_prepare funciton.
5764 static void tgt_pt_prepare(void)
5768 /* Reset "temp" array */
5771 if (!expand_list) return;
5773 /* Scan the current panel */
5774 for (y = 1; y < cur_hgt; y++)
5776 for (x = 1; x < cur_wid; x++)
5778 /* Require "interesting" contents */
5779 if (!tgt_pt_accept(y, x)) continue;
5781 /* Save the location */
5788 /* Target the nearest monster for shooting */
5789 ang_sort_comp = ang_sort_comp_distance;
5790 ang_sort_swap = ang_sort_swap_distance;
5792 /* Sort the positions */
5793 ang_sort(temp_x, temp_y, temp_n);
5797 * old -- from PsiAngband.
5799 bool tgt_pt(int *x_ptr, int *y_ptr)
5803 bool success = FALSE;
5808 get_screen_size(&wid, &hgt);
5820 msg_print("¾ì½ê¤òÁª¤ó¤Ç¥¹¥Ú¡¼¥¹¥¡¼¤ò²¡¤·¤Æ²¼¤µ¤¤¡£");
5822 msg_print("Select a point and press space.");
5824 msg_flag = FALSE; /* prevents "-more-" message. */
5826 while ((ch != ESCAPE) && !success)
5828 bool move_fast = FALSE;
5830 move_cursor_relative(y, x);
5842 if (player_bold(y, x)) ch = 0;
5845 else success = TRUE;
5849 /* XAngband: Move cursor to stairs */
5852 if (expand_list && temp_n)
5855 int cx = (panel_col_min + panel_col_max) / 2;
5856 int cy = (panel_row_min + panel_row_max) / 2;
5860 /* Skip stairs which have defferent distance */
5861 for (; n < temp_n; ++ n)
5863 cave_type *c_ptr = &cave[temp_y[n]][temp_x[n]];
5865 if (cave_have_flag_grid(c_ptr, FF_STAIRS) &&
5866 cave_have_flag_grid(c_ptr, ch == '>' ? FF_MORE : FF_LESS))
5873 if (n == temp_n) /* Loop out taget list */
5878 verify_panel(); /* Move cursor to player */
5881 p_ptr->update |= (PU_MONSTERS);
5884 p_ptr->redraw |= (PR_MAP);
5887 p_ptr->window |= (PW_OVERHEAD);
5892 else /* move cursor to next stair and change panel */
5897 dy = 2 * (y - cy) / hgt;
5898 dx = 2 * (x - cx) / wid;
5899 if (dy || dx) change_panel(dy, dx);
5905 /* Look up the direction */
5906 d = get_keymap_dir(ch);
5908 /* XTRA HACK MOVEFAST */
5909 if (isupper(ch)) move_fast = TRUE;
5911 /* Handle "direction" */
5917 /* XTRA HACK MOVEFAST */
5920 int mag = MIN(wid / 2, hgt / 2);
5930 /* Do not move horizontally if unnecessary */
5931 if (((x < panel_col_min + wid / 2) && (dx > 0)) ||
5932 ((x > panel_col_min + wid / 2) && (dx < 0)))
5937 /* Do not move vertically if unnecessary */
5938 if (((y < panel_row_min + hgt / 2) && (dy > 0)) ||
5939 ((y > panel_row_min + hgt / 2) && (dy < 0)))
5944 /* Apply the motion */
5945 if ((y >= panel_row_min + hgt) || (y < panel_row_min) ||
5946 (x >= panel_col_min + wid) || (x < panel_col_min))
5948 /* if (change_panel(dy, dx)) target_set_prepare(mode); */
5949 change_panel(dy, dx);
5952 /* Slide into legality */
5953 if (x >= cur_wid-1) x = cur_wid - 2;
5954 else if (x <= 0) x = 1;
5956 /* Slide into legality */
5957 if (y >= cur_hgt-1) y = cur_hgt- 2;
5958 else if (y <= 0) y = 1;
5965 /* Clear the top line */
5968 /* Recenter the map around the player */
5972 p_ptr->update |= (PU_MONSTERS);
5975 p_ptr->redraw |= (PR_MAP);
5978 p_ptr->window |= (PW_OVERHEAD);
5989 bool get_hack_dir(int *dp)
5999 /* Global direction */
6002 /* (No auto-targeting) */
6004 /* Ask until satisfied */
6007 /* Choose a prompt */
6011 p = "Êý¸þ ('*'¤Ç¥¿¡¼¥²¥Ã¥ÈÁªÂò, ESC¤ÇÃæÃÇ)? ";
6013 p = "Direction ('*' to choose a target, Escape to cancel)? ";
6020 p = "Êý¸þ ('5'¤Ç¥¿¡¼¥²¥Ã¥È¤Ø, '*'¤Ç¥¿¡¼¥²¥Ã¥ÈºÆÁªÂò, ESC¤ÇÃæÃÇ)? ";
6022 p = "Direction ('5' for target, '*' to re-target, Escape to cancel)? ";
6027 /* Get a command (or Cancel) */
6028 if (!get_com(p, &command, TRUE)) break;
6032 if (command == '\r') command = 't';
6035 /* Convert various keys to "standard" keys */
6038 /* Use current target */
6049 /* Set new target */
6054 if (target_set(TARGET_KILL)) dir = 5;
6060 /* Look up the direction */
6061 dir = get_keymap_dir(command);
6067 /* Verify requested targets */
6068 if ((dir == 5) && !target_okay()) dir = 0;
6075 if (!dir) return (FALSE);
6077 /* Save the direction */
6080 /* Check for confusion */
6081 if (p_ptr->confused)
6084 /* Random direction */
6085 dir = ddd[randint0(8)];
6088 /* Notice confusion */
6089 if (command_dir != dir)
6093 msg_print("¤¢¤Ê¤¿¤Ïº®Í𤷤Ƥ¤¤ë¡£");
6095 msg_print("You are confused.");
6100 /* Save direction */
6103 /* A "valid" direction was entered */
6109 * ¥¨¥Í¥ë¥®¡¼¤ÎÁý²ÃÎÌ10d5¤ò®¤¯·×»»¤¹¤ë¤¿¤á¤Î´Ø¿ô
6112 #define Go_no_JuuJou 5*5*5*5*5*5*5*5*5*5
6114 s16b gain_energy(void)
6117 s32b energy_result = 10;
6120 tmp = randint0(Go_no_JuuJou);
6122 for (i = 0; i < 9; i ++){
6123 energy_result += tmp % 5;
6127 return (s16b)(energy_result + tmp);
6134 s16b bow_energy(int sval)
6138 /* Analyze the launcher */
6141 /* Sling and ammo */
6148 /* Short Bow and Arrow */
6155 /* Long Bow and Arrow */
6162 /* Bow of irresponsiblity and Arrow */
6169 /* Light Crossbow and Bolt */
6176 /* Heavy Crossbow and Bolt */
6191 int bow_tmul(int sval)
6195 /* Analyze the launcher */
6198 /* Sling and ammo */
6205 /* Short Bow and Arrow */
6212 /* Long Bow and Arrow */
6219 /* Bow of irresponsiblity and Arrow */
6226 /* Light Crossbow and Bolt */
6233 /* Heavy Crossbow and Bolt */
6245 * Return alignment title
6247 cptr your_alignment(void)
6250 if (p_ptr->align > 150) return "ÂçÁ±";
6251 else if (p_ptr->align > 50) return "ÃæÁ±";
6252 else if (p_ptr->align > 10) return "¾®Á±";
6253 else if (p_ptr->align > -11) return "ÃæΩ";
6254 else if (p_ptr->align > -51) return "¾®°";
6255 else if (p_ptr->align > -151) return "Ãæ°";
6258 if (p_ptr->align > 150) return "Lawful";
6259 else if (p_ptr->align > 50) return "Good";
6260 else if (p_ptr->align > 10) return "Neutral Good";
6261 else if (p_ptr->align > -11) return "Neutral";
6262 else if (p_ptr->align > -51) return "Neutral Evil";
6263 else if (p_ptr->align > -151) return "Evil";
6264 else return "Chaotic";
6270 * Return proficiency level of weapons and misc. skills (except riding)
6272 int weapon_exp_level(int weapon_exp)
6274 if (weapon_exp < WEAPON_EXP_BEGINNER) return EXP_LEVEL_UNSKILLED;
6275 else if (weapon_exp < WEAPON_EXP_SKILLED) return EXP_LEVEL_BEGINNER;
6276 else if (weapon_exp < WEAPON_EXP_EXPERT) return EXP_LEVEL_SKILLED;
6277 else if (weapon_exp < WEAPON_EXP_MASTER) return EXP_LEVEL_EXPERT;
6278 else return EXP_LEVEL_MASTER;
6283 * Return proficiency level of riding
6285 int riding_exp_level(int riding_exp)
6287 if (riding_exp < RIDING_EXP_BEGINNER) return EXP_LEVEL_UNSKILLED;
6288 else if (riding_exp < RIDING_EXP_SKILLED) return EXP_LEVEL_BEGINNER;
6289 else if (riding_exp < RIDING_EXP_EXPERT) return EXP_LEVEL_SKILLED;
6290 else if (riding_exp < RIDING_EXP_MASTER) return EXP_LEVEL_EXPERT;
6291 else return EXP_LEVEL_MASTER;
6296 * Return proficiency level of spells
6298 int spell_exp_level(int spell_exp)
6300 if (spell_exp < SPELL_EXP_BEGINNER) return EXP_LEVEL_UNSKILLED;
6301 else if (spell_exp < SPELL_EXP_SKILLED) return EXP_LEVEL_BEGINNER;
6302 else if (spell_exp < SPELL_EXP_EXPERT) return EXP_LEVEL_SKILLED;
6303 else if (spell_exp < SPELL_EXP_MASTER) return EXP_LEVEL_EXPERT;
6304 else return EXP_LEVEL_MASTER;
6309 * Display a rumor and apply its effects
6312 int rumor_num(char *zz, int max_idx)
6314 if (strcmp(zz, "*") == 0) return randint1(max_idx - 1);
6318 cptr rumor_bind_name(char *base, cptr fullname)
6322 s = strstr(base, "{Name}");
6326 v = format("%s%s%s", base, fullname, (s + 6));
6336 void display_rumor(bool ex)
6344 if (randint0(3) == 0) section = 1;
6348 err = get_rnd_line_jonly("rumors_j.txt", section, Rumor, 10);
6349 if (err) strcpy(Rumor, "±³¤Î±½¤â¤¢¤ë¡£");
6351 err = get_rnd_line("rumors.txt", section, Rumor);
6352 if (err) strcpy(Rumor, "Some rumors are wrong.");
6357 if (strncmp(Rumor, "R:", 2) == 0)
6360 cptr rumor_msg = NULL;
6361 cptr rumor_eff_format = NULL;
6362 char fullname[1024] = "";
6364 if (tokenize(Rumor + 2, 3, zz, TOKENIZE_CHECKQUOTE) == 3)
6366 if (strcmp(zz[0], "ARTIFACT") == 0)
6370 object_type *q_ptr = &forge;
6371 artifact_type *a_ptr;
6375 a_idx = rumor_num(zz[1], max_a_idx);
6377 a_ptr = &a_info[a_idx];
6378 if (a_ptr->name) break;
6381 k_idx = lookup_kind(a_ptr->tval, a_ptr->sval);
6382 object_prep(q_ptr, k_idx);
6383 q_ptr->name1 = a_idx;
6384 q_ptr->ident = IDENT_STORE;
6385 object_desc(fullname, q_ptr, OD_NAME_ONLY);
6387 else if (strcmp(zz[0], "MONSTER") == 0)
6390 monster_race *r_ptr;
6394 r_idx = rumor_num(zz[1], max_r_idx);
6395 r_ptr = &r_info[r_idx];
6396 if (r_ptr->name) break;
6399 strcpy(fullname, r_name + r_ptr->name);
6401 /* Remember this monster */
6402 if (!r_ptr->r_sights)
6407 else if (strcmp(zz[0], "DUNGEON") == 0)
6410 dungeon_info_type *d_ptr;
6414 d_idx = rumor_num(zz[1], max_d_idx);
6415 d_ptr = &d_info[d_idx];
6416 if (d_ptr->name) break;
6419 strcpy(fullname, d_name + d_ptr->name);
6421 if (!max_dlv[d_idx])
6423 max_dlv[d_idx] = d_ptr->mindepth;
6424 rumor_eff_format = _("%s¤Ëµ¢´Ô¤Ç¤¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¡£", "You can recall to %s.");
6427 else if (strcmp(zz[0], "TOWN") == 0)
6434 t_idx = rumor_num(zz[1], NO_TOWN);
6435 if (town[t_idx].name) break;
6438 strcpy(fullname, town[t_idx].name);
6440 visit = (1L << (t_idx - 1));
6441 if ((t_idx != SECRET_TOWN) && !(p_ptr->visit & visit))
6443 p_ptr->visit |= visit;
6444 rumor_eff_format = _("%s¤Ë¹Ô¤Ã¤¿¤³¤È¤¬¤¢¤ëµ¤¤¬¤¹¤ë¡£", "You feel you have been to %s.");
6448 rumor_msg = rumor_bind_name(zz[2], fullname);
6449 msg_print(rumor_msg);
6450 if (rumor_eff_format)
6453 msg_format(rumor_eff_format, fullname);
6459 if (err) msg_print("¤³¤Î¾ðÊó¤Ï´Ö°ã¤Ã¤Æ¤¤¤ë¡£");
6461 if (err) msg_print("This information is wrong.");
6466 msg_format("%s", Rumor);