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 quest_type* const q_ptr = &quest[quest_num];
386 case QUEST_TYPE_RANDOM:
387 if (record_rand_quest) do_cmd_write_nikki(NIKKI_RAND_QUEST_C, quest_num, NULL);
390 if (record_fix_quest) do_cmd_write_nikki(NIKKI_FIX_QUEST_C, quest_num, NULL);
394 q_ptr->status = QUEST_STATUS_COMPLETED;
395 q_ptr->complev = (byte)p_ptr->lev;
397 q_ptr->comptime = playtime;
399 if (!(q_ptr->flags & QUEST_FLAG_SILENT))
401 msg_print(_("¥¯¥¨¥¹¥È¤òãÀ®¤·¤¿¡ª", "You just completed your quest!"));
406 static int count_all_hostile_monsters(void)
411 for (x = 0; x < cur_wid; ++ x)
413 for (y = 0; y < cur_hgt; ++ y)
415 int m_idx = cave[y][x].m_idx;
417 if (m_idx > 0 && is_hostile(&m_list[m_idx]))
428 * Check for "Quest" completion when a quest monster is killed or charmed.
430 void check_quest_completion(monster_type *m_ptr)
436 bool create_stairs = FALSE;
442 /* Get the location */
447 quest_num = p_ptr->inside_quest;
449 /* Search for an active quest on this dungeon level */
454 for (i = max_quests - 1; i > 0; i--)
456 quest_type* const q_ptr = &quest[i];
458 /* Quest is not active */
459 if (q_ptr->status != QUEST_STATUS_TAKEN)
462 /* Quest is not a dungeon quest */
463 if (q_ptr->flags & QUEST_FLAG_PRESET)
466 /* Quest is not on this level */
467 if ((q_ptr->level != dun_level) &&
468 (q_ptr->type != QUEST_TYPE_KILL_ANY_LEVEL))
471 /* Not a "kill monster" quest */
472 if ((q_ptr->type == QUEST_TYPE_FIND_ARTIFACT) ||
473 (q_ptr->type == QUEST_TYPE_FIND_EXIT))
476 /* Interesting quest */
477 if ((q_ptr->type == QUEST_TYPE_KILL_NUMBER) ||
478 (q_ptr->type == QUEST_TYPE_TOWER) ||
479 (q_ptr->type == QUEST_TYPE_KILL_ALL))
482 /* Interesting quest */
483 if (((q_ptr->type == QUEST_TYPE_KILL_LEVEL) ||
484 (q_ptr->type == QUEST_TYPE_KILL_ANY_LEVEL) ||
485 (q_ptr->type == QUEST_TYPE_RANDOM)) &&
486 (q_ptr->r_idx == m_ptr->r_idx))
493 /* Handle the current quest */
494 if (quest_num && (quest[quest_num].status == QUEST_STATUS_TAKEN))
497 quest_type* const q_ptr = &quest[quest_num];
501 case QUEST_TYPE_KILL_NUMBER:
505 if (q_ptr->cur_num >= q_ptr->num_mon)
507 complete_quest(quest_num);
513 case QUEST_TYPE_KILL_ALL:
515 if (!is_hostile(m_ptr)) break;
517 if (count_all_hostile_monsters() == 1)
519 if (q_ptr->flags & QUEST_FLAG_SILENT)
521 q_ptr->status = QUEST_STATUS_FINISHED;
525 complete_quest(quest_num);
530 case QUEST_TYPE_KILL_LEVEL:
531 case QUEST_TYPE_RANDOM:
533 /* Only count valid monsters */
534 if (q_ptr->r_idx != m_ptr->r_idx)
539 if (q_ptr->cur_num >= q_ptr->max_num)
541 complete_quest(quest_num);
543 if (!(q_ptr->flags & QUEST_FLAG_PRESET))
545 create_stairs = TRUE;
546 p_ptr->inside_quest = 0;
549 /* Finish the two main quests without rewarding */
550 if ((quest_num == QUEST_OBERON) || (quest_num == QUEST_SERPENT))
552 q_ptr->status = QUEST_STATUS_FINISHED;
555 if (q_ptr->type == QUEST_TYPE_RANDOM)
558 q_ptr->status = QUEST_STATUS_FINISHED;
563 case QUEST_TYPE_KILL_ANY_LEVEL:
566 if (q_ptr->cur_num >= q_ptr->max_num)
568 complete_quest(quest_num);
573 case QUEST_TYPE_TOWER:
575 if (!is_hostile(m_ptr)) break;
577 if (count_all_hostile_monsters() == 1)
579 q_ptr->status = QUEST_STATUS_STAGE_COMPLETED;
581 if((quest[QUEST_TOWER1].status == QUEST_STATUS_STAGE_COMPLETED) &&
582 (quest[QUEST_TOWER2].status == QUEST_STATUS_STAGE_COMPLETED) &&
583 (quest[QUEST_TOWER3].status == QUEST_STATUS_STAGE_COMPLETED))
586 complete_quest(QUEST_TOWER1);
594 /* Create a magical staircase */
600 while (cave_perma_bold(y, x) || cave[y][x].o_idx || (cave[y][x].info & CAVE_OBJECT) )
602 /* Pick a location */
603 scatter(&ny, &nx, y, x, 1, 0);
609 /* Explain the staircase */
611 msg_print("ËâË¡¤Î³¬Ãʤ¬¸½¤ì¤¿...");
613 msg_print("A magical staircase appears...");
617 /* Create stairs down */
618 cave_set_feat(y, x, feat_down_stair);
620 /* Remember to update everything */
621 p_ptr->update |= (PU_FLOW);
631 for (i = 0; i < (dun_level / 15)+1; i++)
633 /* Get local object */
636 /* Wipe the object */
639 /* Make a great object */
640 make_object(q_ptr, AM_GOOD | AM_GREAT);
642 /* Drop it in the dungeon */
643 (void)drop_near(q_ptr, -1, y, x);
649 void check_find_art_quest_completion(object_type *o_ptr)
652 /* Check if completed a quest */
653 for (i = 0; i < max_quests; i++)
655 if ((quest[i].type == QUEST_TYPE_FIND_ARTIFACT) &&
656 (quest[i].status == QUEST_STATUS_TAKEN) &&
657 (quest[i].k_idx == o_ptr->name1))
665 * Return monster death string
667 cptr extract_note_dies(monster_race *r_ptr)
669 /* Some monsters get "destroyed" */
670 if (!monster_living(r_ptr))
674 for (i = 0; i < 4; i++)
676 if (r_ptr->blow[i].method == RBM_EXPLODE)
679 return "¤ÏÇúȯ¤·¤ÆÊ´¡¹¤Ë¤Ê¤Ã¤¿¡£";
681 return " explodes into tiny shreds.";
689 return " is destroyed.";
693 /* Assume a default death */
703 * Handle the "death" of a monster.
705 * Disperse treasures centered at the monster location based on the
706 * various flags contained in the monster flags fields.
708 * Check for "Quest" completion when a quest monster is killed.
710 * Note that only the player can induce "monster_death()" on Uniques.
711 * Thus (for now) all Quest monsters should be Uniques.
713 * Note that monsters can now carry objects, and when a monster dies,
714 * it drops all of its objects, which may disappear in crowded rooms.
716 void monster_death(int m_idx, bool drop_item)
725 monster_type *m_ptr = &m_list[m_idx];
727 monster_race *r_ptr = &r_info[m_ptr->r_idx];
729 bool visible = ((m_ptr->ml && !p_ptr->image) || (r_ptr->flags1 & RF1_UNIQUE));
733 bool do_gold = (!(r_ptr->flags1 & RF1_ONLY_ITEM));
734 bool do_item = (!(r_ptr->flags1 & RF1_ONLY_GOLD));
735 bool cloned = (m_ptr->smart & SM_CLONED) ? TRUE : FALSE;
736 int force_coin = get_coin_type(m_ptr->r_idx);
741 bool drop_chosen_item = drop_item && !cloned && !p_ptr->inside_arena
742 && !p_ptr->inside_battle && !is_pet(m_ptr);
744 /* The caster is dead? */
745 if (world_monster && world_monster == m_idx) world_monster = 0;
747 /* Notice changes in view */
748 if (r_ptr->flags7 & (RF7_LITE_MASK | RF7_DARK_MASK))
750 /* Update some things */
751 p_ptr->update |= (PU_MON_LITE);
754 /* Get the location */
758 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
762 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
763 do_cmd_write_nikki(NIKKI_NAMED_PET, 3, m_name);
766 /* Let monsters explode! */
767 for (i = 0; i < 4; i++)
769 if (r_ptr->blow[i].method == RBM_EXPLODE)
771 int flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
772 int typ = mbe_info[r_ptr->blow[i].effect].explode_type;
773 int d_dice = r_ptr->blow[i].d_dice;
774 int d_side = r_ptr->blow[i].d_side;
775 int damage = damroll(d_dice, d_side);
777 project(m_idx, 3, y, x, damage, typ, flg, -1);
782 if (m_ptr->mflag2 & MFLAG2_CHAMELEON)
784 choose_new_monster(m_idx, TRUE, MON_CHAMELEON);
785 r_ptr = &r_info[m_ptr->r_idx];
788 /* Check for quest completion */
789 check_quest_completion(m_ptr);
791 /* Handle the possibility of player vanquishing arena combatant -KMW- */
792 if (p_ptr->inside_arena && !is_pet(m_ptr))
794 p_ptr->exit_bldg = TRUE;
796 if (p_ptr->arena_number > MAX_ARENA_MONS)
799 msg_print("ÁÇÀ²¤é¤·¤¤¡ª·¯¤³¤½¿¿¤Î¾¡Íø¼Ô¤À¡£");
801 msg_print("You are a Genuine Champion!");
807 msg_print("¾¡Íø¡ª¥Á¥ã¥ó¥Ô¥ª¥ó¤Ø¤ÎÆ»¤ò¿Ê¤ó¤Ç¤¤¤ë¡£");
809 msg_print("Victorious! You're on your way to becoming Champion.");
813 if (arena_info[p_ptr->arena_number].tval)
815 /* Get local object */
818 /* Prepare to make a prize */
819 object_prep(q_ptr, lookup_kind(arena_info[p_ptr->arena_number].tval, arena_info[p_ptr->arena_number].sval));
821 apply_magic(q_ptr, object_level, AM_NO_FIXED_ART);
823 /* Drop it in the dungeon */
824 (void)drop_near(q_ptr, -1, y, x);
827 if (p_ptr->arena_number > MAX_ARENA_MONS) p_ptr->arena_number++;
828 p_ptr->arena_number++;
833 /* Extract monster name */
834 monster_desc(m_name, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
836 do_cmd_write_nikki(NIKKI_ARENA, p_ptr->arena_number, m_name);
840 if (m_idx == p_ptr->riding)
842 if (rakuba(-1, FALSE))
845 msg_print("ÃÏÌ̤ËÍî¤È¤µ¤ì¤¿¡£");
847 msg_print("You have fallen from your riding pet.");
852 /* Drop a dead corpse? */
853 if (one_in_(r_ptr->flags1 & RF1_UNIQUE ? 1 : 4) &&
854 (r_ptr->flags9 & (RF9_DROP_CORPSE | RF9_DROP_SKELETON)) &&
855 !(p_ptr->inside_arena || p_ptr->inside_battle || cloned || ((m_ptr->r_idx == today_mon) && is_pet(m_ptr))))
857 /* Assume skeleton */
861 * We cannot drop a skeleton? Note, if we are in this check,
862 * we *know* we can drop at least a corpse or a skeleton
864 if (!(r_ptr->flags9 & RF9_DROP_SKELETON))
866 else if ((r_ptr->flags9 & RF9_DROP_CORPSE) && (r_ptr->flags1 & RF1_UNIQUE))
869 /* Else, a corpse is more likely unless we did a "lot" of damage */
870 else if (r_ptr->flags9 & RF9_DROP_CORPSE)
872 /* Lots of damage in one blow */
873 if ((0 - ((m_ptr->maxhp) / 4)) > m_ptr->hp)
875 if (one_in_(5)) corpse = TRUE;
879 if (!one_in_(5)) corpse = TRUE;
883 /* Get local object */
886 /* Prepare to make an object */
887 object_prep(q_ptr, lookup_kind(TV_CORPSE, (corpse ? SV_CORPSE : SV_SKELETON)));
889 apply_magic(q_ptr, object_level, AM_NO_FIXED_ART);
891 q_ptr->pval = m_ptr->r_idx;
893 /* Drop it in the dungeon */
894 (void)drop_near(q_ptr, -1, y, x);
897 /* Drop objects being carried */
898 monster_drop_carried_objects(m_ptr);
900 if (r_ptr->flags1 & RF1_DROP_GOOD) mo_mode |= AM_GOOD;
901 if (r_ptr->flags1 & RF1_DROP_GREAT) mo_mode |= AM_GREAT;
903 switch (m_ptr->r_idx)
905 case MON_PINK_HORROR:
906 /* Pink horrors are replaced with 2 Blue horrors */
907 if (!(p_ptr->inside_arena || p_ptr->inside_battle))
911 for (i = 0; i < 2; i++)
914 bool pet = is_pet(m_ptr);
917 if (pet) mode |= PM_FORCE_PET;
919 if (summon_specific((pet ? -1 : m_idx), wy, wx, 100, SUMMON_BLUE_HORROR, mode))
921 if (player_can_see_bold(wy, wx))
928 msg_print("¥Ô¥ó¥¯¡¦¥Û¥é¡¼¤ÏʬÎö¤·¤¿¡ª");
930 msg_print("The Pink horror divides!");
935 case MON_BLOODLETTER:
936 /* Bloodletters of Khorne may drop a blade of chaos */
937 if (drop_chosen_item && (randint1(100) < 15))
939 /* Get local object */
942 /* Prepare to make a Blade of Chaos */
943 object_prep(q_ptr, lookup_kind(TV_SWORD, SV_BLADE_OF_CHAOS));
945 apply_magic(q_ptr, object_level, AM_NO_FIXED_ART | mo_mode);
947 /* Drop it in the dungeon */
948 (void)drop_near(q_ptr, -1, y, x);
953 if (drop_chosen_item && (dun_level > 9))
955 /* Get local object */
958 /* Wipe the object */
961 /* Activate restriction */
962 if ((dun_level > 49) && one_in_(5))
963 get_obj_num_hook = kind_is_good_book;
965 get_obj_num_hook = kind_is_book;
968 make_object(q_ptr, mo_mode);
970 /* Drop it in the dungeon */
971 (void)drop_near(q_ptr, -1, y, x);
977 * Mega^3-hack: killing a 'Warrior of the Dawn' is likely to
978 * spawn another in the fallen one's place!
980 if (!p_ptr->inside_arena && !p_ptr->inside_battle)
986 bool pet = is_pet(m_ptr);
990 scatter(&wy, &wx, y, x, 20, 0);
992 while (!(in_bounds(wy, wx) && cave_empty_bold2(wy, wx)) && --attempts);
997 if (pet) mode |= PM_FORCE_PET;
999 if (summon_specific((pet ? -1 : m_idx), wy, wx, 100, SUMMON_DAWN, mode))
1001 if (player_can_see_bold(wy, wx))
1003 msg_print("¿·¤¿¤ÊÀï»Î¤¬¸½¤ì¤¿¡ª");
1005 msg_print("A new warrior steps forth!");
1015 /* One more ultra-hack: An Unmaker goes out with a big bang! */
1017 int flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
1018 (void)project(m_idx, 6, y, x, 100, GF_CHAOS, flg, -1);
1022 case MON_UNICORN_ORD:
1025 /* Reward for "lazy" player */
1026 if (p_ptr->pseikaku == SEIKAKU_NAMAKE)
1029 artifact_type *a_ptr = NULL;
1031 if (!drop_chosen_item) break;
1035 switch (randint0(3))
1038 a_idx = ART_NAMAKE_HAMMER;
1041 a_idx = ART_NAMAKE_BOW;
1044 a_idx = ART_NAMAKE_ARMOR;
1048 a_ptr = &a_info[a_idx];
1050 while (a_ptr->cur_num);
1052 /* Create the artifact */
1053 if (create_named_art(a_idx, y, x))
1057 /* Hack -- Memorize location of artifact in saved floors */
1058 if (character_dungeon) a_ptr->floor_id = p_ptr->floor_id;
1060 else if (!preserve_mode) a_ptr->cur_num = 1;
1065 if (!drop_chosen_item) break;
1067 /* Get local object */
1070 /* Mega-Hack -- Prepare to make "Grond" */
1071 object_prep(q_ptr, lookup_kind(TV_HAFTED, SV_GROND));
1073 /* Mega-Hack -- Mark this item as "Grond" */
1074 q_ptr->name1 = ART_GROND;
1076 /* Mega-Hack -- Actually create "Grond" */
1077 apply_magic(q_ptr, -1, AM_GOOD | AM_GREAT);
1079 /* Drop it in the dungeon */
1080 (void)drop_near(q_ptr, -1, y, x);
1082 /* Get local object */
1085 /* Mega-Hack -- Prepare to make "Chaos" */
1086 object_prep(q_ptr, lookup_kind(TV_CROWN, SV_CHAOS));
1088 /* Mega-Hack -- Mark this item as "Chaos" */
1089 q_ptr->name1 = ART_CHAOS;
1091 /* Mega-Hack -- Actually create "Chaos" */
1092 apply_magic(q_ptr, -1, AM_GOOD | AM_GREAT);
1094 /* Drop it in the dungeon */
1095 (void)drop_near(q_ptr, -1, y, x);
1098 case MON_B_DEATH_SWORD:
1099 if (drop_chosen_item)
1101 /* Get local object */
1104 /* Prepare to make a broken sword */
1105 object_prep(q_ptr, lookup_kind(TV_SWORD, randint1(2)));
1107 /* Drop it in the dungeon */
1108 (void)drop_near(q_ptr, -1, y, x);
1114 if (drop_chosen_item && ((m_ptr->r_idx == MON_A_GOLD) ||
1115 ((m_ptr->r_idx == MON_A_SILVER) && (r_ptr->r_akills % 5 == 0))))
1117 /* Get local object */
1120 /* Prepare to make a Can of Toys */
1121 object_prep(q_ptr, lookup_kind(TV_CHEST, SV_CHEST_KANDUME));
1123 apply_magic(q_ptr, object_level, AM_NO_FIXED_ART);
1125 /* Drop it in the dungeon */
1126 (void)drop_near(q_ptr, -1, y, x);
1132 int flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
1133 (void)project(m_idx, 3, y, x, damroll(20, 10), GF_FIRE, flg, -1);
1138 if (!drop_chosen_item) break;
1140 switch (r_ptr->d_char)
1145 /* Get local object */
1148 /* Wipe the object */
1151 /* Activate restriction */
1152 get_obj_num_hook = kind_is_cloak;
1155 make_object(q_ptr, mo_mode);
1157 /* Drop it in the dungeon */
1158 (void)drop_near(q_ptr, -1, y, x);
1165 /* Get local object */
1168 /* Wipe the object */
1171 /* Activate restriction */
1172 get_obj_num_hook = kind_is_polearm;
1174 /* Make a poleweapon */
1175 make_object(q_ptr, mo_mode);
1177 /* Drop it in the dungeon */
1178 (void)drop_near(q_ptr, -1, y, x);
1185 /* Get local object */
1188 /* Wipe the object */
1191 /* Activate restriction */
1192 get_obj_num_hook = kind_is_armor;
1194 /* Make a hard armor */
1195 make_object(q_ptr, mo_mode);
1197 /* Drop it in the dungeon */
1198 (void)drop_near(q_ptr, -1, y, x);
1205 /* Get local object */
1208 /* Wipe the object */
1211 /* Activate restriction */
1212 get_obj_num_hook = kind_is_hafted;
1214 /* Make a hafted weapon */
1215 make_object(q_ptr, mo_mode);
1217 /* Drop it in the dungeon */
1218 (void)drop_near(q_ptr, -1, y, x);
1223 if (m_ptr->r_idx != MON_STORMBRINGER)
1225 /* Get local object */
1228 /* Wipe the object */
1231 /* Activate restriction */
1232 get_obj_num_hook = kind_is_sword;
1235 make_object(q_ptr, mo_mode);
1237 /* Drop it in the dungeon */
1238 (void)drop_near(q_ptr, -1, y, x);
1245 /* Mega-Hack -- drop fixed items */
1246 if (drop_chosen_item)
1251 switch (m_ptr->r_idx)
1271 case MON_STORMBRINGER:
1272 a_idx = ART_STORMBRINGER;
1277 a_idx = ART_CRIMSON;
1287 a_idx = ART_KUSANAGI;
1317 a_idx = ART_WEREWINDLE;
1325 a_idx = ART_GRAYSWANDIR;
1338 a_idx = ART_TWILIGHT;
1343 a_idx = ART_ORB_OF_FATE;
1349 a_idx = ART_ELENDIL;
1364 a_idx = ART_DESTINY;
1369 a_idx = ART_ZANTETSU;
1384 a_idx = ART_WINBLOWS;
1388 case MON_LUNGORTHIN:
1393 case MON_JACK_SHADOWS:
1399 a_idx = ART_STONEMASK;
1404 a_idx = ART_SOULCRUSH;
1409 a_idx = ART_EXCALIBUR_J;
1414 a_idx = ART_SHUTEN_DOJI;
1419 a_idx = ART_GOTHMOG;
1428 case MON_ROBIN_HOOD:
1429 a_idx = ART_ROBIN_HOOD;
1434 if ((a_idx > 0) && ((randint0(100) < chance) || p_ptr->wizard))
1436 artifact_type *a_ptr = &a_info[a_idx];
1438 if (!a_ptr->cur_num)
1440 /* Create the artifact */
1441 if (create_named_art(a_idx, y, x))
1445 /* Hack -- Memorize location of artifact in saved floors */
1446 if (character_dungeon) a_ptr->floor_id = p_ptr->floor_id;
1448 else if (!preserve_mode) a_ptr->cur_num = 1;
1452 if ((r_ptr->flags7 & RF7_GUARDIAN) && (d_info[dungeon_type].final_guardian == m_ptr->r_idx))
1454 int k_idx = d_info[dungeon_type].final_object ? d_info[dungeon_type].final_object
1455 : lookup_kind(TV_SCROLL, SV_SCROLL_ACQUIREMENT);
1457 if (d_info[dungeon_type].final_artifact)
1459 int a_idx = d_info[dungeon_type].final_artifact;
1460 artifact_type *a_ptr = &a_info[a_idx];
1462 if (!a_ptr->cur_num)
1464 /* Create the artifact */
1465 if (create_named_art(a_idx, y, x))
1469 /* Hack -- Memorize location of artifact in saved floors */
1470 if (character_dungeon) a_ptr->floor_id = p_ptr->floor_id;
1472 else if (!preserve_mode) a_ptr->cur_num = 1;
1474 /* Prevent rewarding both artifact and "default" object */
1475 if (!d_info[dungeon_type].final_object) k_idx = 0;
1481 /* Get local object */
1484 /* Prepare to make a reward */
1485 object_prep(q_ptr, k_idx);
1487 apply_magic(q_ptr, object_level, AM_NO_FIXED_ART | AM_GOOD);
1489 /* Drop it in the dungeon */
1490 (void)drop_near(q_ptr, -1, y, x);
1493 msg_format("¤¢¤Ê¤¿¤Ï%s¤òÀ©ÇƤ·¤¿¡ª",d_name+d_info[dungeon_type].name);
1495 msg_format("You have conquered %s!",d_name+d_info[dungeon_type].name);
1500 /* Determine how much we can drop */
1501 if ((r_ptr->flags1 & RF1_DROP_60) && (randint0(100) < 60)) number++;
1502 if ((r_ptr->flags1 & RF1_DROP_90) && (randint0(100) < 90)) number++;
1503 if (r_ptr->flags1 & RF1_DROP_1D2) number += damroll(1, 2);
1504 if (r_ptr->flags1 & RF1_DROP_2D2) number += damroll(2, 2);
1505 if (r_ptr->flags1 & RF1_DROP_3D2) number += damroll(3, 2);
1506 if (r_ptr->flags1 & RF1_DROP_4D2) number += damroll(4, 2);
1508 if (cloned && !(r_ptr->flags1 & RF1_UNIQUE))
1509 number = 0; /* Clones drop no stuff unless Cloning Pits */
1511 if (is_pet(m_ptr) || p_ptr->inside_battle || p_ptr->inside_arena)
1512 number = 0; /* Pets drop no stuff */
1513 if (!drop_item && (r_ptr->d_char != '$')) number = 0;
1515 if((r_ptr->flags2 & (RF2_MULTIPLY)) && (r_ptr->r_akills > 1024))
1516 number = 0; /* Limit of Multiply monster drop */
1518 /* Hack -- handle creeping coins */
1519 coin_type = force_coin;
1521 /* Average dungeon and monster levels */
1522 object_level = (dun_level + r_ptr->level) / 2;
1524 /* Drop some objects */
1525 for (j = 0; j < number; j++)
1527 /* Get local object */
1530 /* Wipe the object */
1534 if (do_gold && (!do_item || (randint0(100) < 50)))
1536 /* Make some gold */
1537 if (!make_gold(q_ptr)) continue;
1546 /* Make an object */
1547 if (!make_object(q_ptr, mo_mode)) continue;
1553 /* Drop it in the dungeon */
1554 (void)drop_near(q_ptr, -1, y, x);
1557 /* Reset the object level */
1558 object_level = base_level;
1560 /* Reset "coin" type */
1564 /* Take note of any dropped treasure */
1565 if (visible && (dump_item || dump_gold))
1567 /* Take notes on treasure */
1568 lore_treasure(m_idx, dump_item, dump_gold);
1571 /* Only process "Quest Monsters" */
1572 if (!(r_ptr->flags1 & RF1_QUESTOR)) return;
1573 if (p_ptr->inside_battle) return;
1576 if ((m_ptr->r_idx == MON_SERPENT) && !cloned)
1579 p_ptr->total_winner = TRUE;
1581 /* Redraw the "title" */
1582 p_ptr->redraw |= (PR_TITLE);
1585 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "¸«»ö¤ËÊѶòÈÚÅܤξ¡Íø¼Ô¤È¤Ê¤Ã¤¿¡ª");
1587 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "become *WINNER* of Hengband finely!");
1590 if ((p_ptr->pclass == CLASS_CHAOS_WARRIOR) || (p_ptr->muta2 & MUT2_CHAOS_GIFT))
1593 msg_format("%s¤«¤é¤ÎÀ¼¤¬¶Á¤¤¤¿¡£", chaos_patrons[p_ptr->chaos_patron]);
1594 msg_print("¡Ø¤è¤¯¤ä¤Ã¤¿¡¢ÄêÌ¿¤Î¼Ô¤è¡ª¡Ù");
1596 msg_format("The voice of %s booms out:", chaos_patrons[p_ptr->chaos_patron]);
1597 msg_print("'Thou art donst well, mortal!'");
1601 /* Congratulations */
1603 msg_print("*** ¤ª¤á¤Ç¤È¤¦ ***");
1605 msg_print("*** CONGRATULATIONS ***");
1609 msg_print("¤¢¤Ê¤¿¤Ï¥²¡¼¥à¤ò¥³¥ó¥×¥ê¡¼¥È¤·¤Þ¤·¤¿¡£");
1611 msg_print("You have won the game!");
1615 msg_print("½àÈ÷¤¬À°¤Ã¤¿¤é°úÂà(¼«»¦¥³¥Þ¥ó¥É)¤·¤Æ¤â·ë¹½¤Ç¤¹¡£");
1617 msg_print("You may retire (commit suicide) when you are ready.");
1623 * Modify the physical damage done to the monster.
1624 * (for example when it's invulnerable or shielded)
1626 * ToDo: Accept a damage-type to calculate the modified damage from
1627 * things like fire, frost, lightning, poison, ... attacks.
1629 * "type" is not yet used and should be 0.
1631 int mon_damage_mod(monster_type *m_ptr, int dam, bool is_psy_spear)
1633 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1635 if ((r_ptr->flagsr & RFR_RES_ALL) && dam > 0)
1638 if ((dam == 0) && one_in_(3)) dam = 1;
1641 if (MON_INVULNER(m_ptr))
1645 if (!p_ptr->blind && is_seen(m_ptr))
1648 msg_print("¥Ð¥ê¥¢¤òÀÚ¤êÎö¤¤¤¿¡ª");
1650 msg_print("The barrier is penetrated!");
1654 else if (!one_in_(PENETRATE_INVULNERABILITY))
1664 * Calculate experience point to be get
1666 * Even the 64 bit operation is not big enough to avoid overflaw
1667 * unless we carefully choose orders of multiplication and division.
1669 * Get the coefficient first, and multiply (potentially huge) base
1670 * experience point of a monster later.
1672 static void get_exp_from_mon(int dam, monster_type *m_ptr)
1674 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1681 if (!m_ptr->r_idx) return;
1682 if (is_pet(m_ptr) || p_ptr->inside_battle) return;
1685 * - Ratio of monster's level to player's level effects
1686 * - Varying speed effects
1687 * - Get a fraction in proportion of damage point
1689 new_exp = r_ptr->level * SPEED_TO_ENERGY(m_ptr->mspeed) * dam;
1692 div_l = (p_ptr->max_plv+2) * SPEED_TO_ENERGY(r_ptr->speed);
1694 /* Use (average maxhp * 2) as a denominator */
1695 if (!(r_ptr->flags1 & RF1_FORCE_MAXHP))
1696 s64b_mul(&div_h, &div_l, 0, r_ptr->hdice * (ironman_nightmare ? 2 : 1) * (r_ptr->hside + 1));
1698 s64b_mul(&div_h, &div_l, 0, r_ptr->hdice * (ironman_nightmare ? 2 : 1) * r_ptr->hside * 2);
1700 /* Special penalty in the wilderness */
1701 if (!dun_level && (!(r_ptr->flags8 & RF8_WILD_ONLY) || !(r_ptr->flags1 & RF1_UNIQUE)))
1702 s64b_mul(&div_h, &div_l, 0, 5);
1704 /* Do division first to prevent overflaw */
1705 s64b_div(&new_exp, &new_exp_frac, div_h, div_l);
1707 /* Special penalty for mutiply-monster */
1708 if ((r_ptr->flags2 & RF2_MULTIPLY) || (m_ptr->r_idx == MON_DAWN))
1710 int monnum_penarty = r_ptr->r_akills / 400;
1711 if (monnum_penarty > 8) monnum_penarty = 8;
1713 while (monnum_penarty--)
1716 s64b_RSHIFT(new_exp, new_exp_frac, 2);
1720 /* Special penalty for rest_and_shoot exp scum */
1721 if ((m_ptr->dealt_damage > m_ptr->max_maxhp) && (m_ptr->hp >= 0))
1723 int over_damage = m_ptr->dealt_damage / m_ptr->max_maxhp;
1724 if (over_damage > 32) over_damage = 32;
1726 while (over_damage--)
1729 s64b_mul(&new_exp, &new_exp_frac, 0, 9);
1730 s64b_div(&new_exp, &new_exp_frac, 0, 10);
1734 /* Finally multiply base experience point of the monster */
1735 s64b_mul(&new_exp, &new_exp_frac, 0, r_ptr->mexp);
1737 /* Gain experience */
1738 gain_exp_64(new_exp, new_exp_frac);
1743 * Decreases monsters hit points, handling monster death.
1745 * We return TRUE if the monster has been killed (and deleted).
1747 * We announce monster death (using an optional "death message"
1748 * if given, and a otherwise a generic killed/destroyed message).
1750 * Only "physical attacks" can induce the "You have slain" message.
1751 * Missile and Spell attacks will induce the "dies" message, or
1752 * various "specialized" messages. Note that "You have destroyed"
1753 * and "is destroyed" are synonyms for "You have slain" and "dies".
1755 * Hack -- unseen monsters yield "You have killed it." message.
1757 * Added fear (DGK) and check whether to print fear messages -CWS
1759 * Made name, sex, and capitalization generic -BEN-
1761 * As always, the "ghost" processing is a total hack.
1763 * Hack -- we "delay" fear messages by passing around a "fear" flag.
1765 * XXX XXX XXX Consider decreasing monster experience over time, say,
1766 * by using "(m_exp * m_lev * (m_lev)) / (p_lev * (m_lev + n_killed))"
1767 * instead of simply "(m_exp * m_lev) / (p_lev)", to make the first
1768 * monster worth more than subsequent monsters. This would also need
1769 * to induce changes in the monster recall code.
1771 bool mon_take_hit(int m_idx, int dam, bool *fear, cptr note)
1773 monster_type *m_ptr = &m_list[m_idx];
1774 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1776 monster_type exp_mon;
1778 /* Innocent until proven otherwise */
1779 bool innocent = TRUE, thief = FALSE;
1784 (void)COPY(&exp_mon, m_ptr, monster_type);
1786 expdam = (m_ptr->hp > dam) ? dam : m_ptr->hp;
1788 get_exp_from_mon(expdam, &exp_mon);
1790 /* Genocided by chaos patron */
1791 if (!m_ptr->r_idx) m_idx = 0;
1793 /* Redraw (later) if needed */
1794 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1795 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
1798 (void)set_monster_csleep(m_idx, 0);
1800 /* Hack - Cancel any special player stealth magics. -LM- */
1801 if (p_ptr->special_defense & NINJA_S_STEALTH)
1803 set_superstealth(FALSE);
1806 /* Genocided by chaos patron */
1807 if (!m_idx) return TRUE;
1809 /* Remember dealt_damage before this attack*/
1810 dealt_damage = m_ptr->dealt_damage;
1815 m_ptr->dealt_damage += dam;
1816 if(m_ptr->dealt_damage > m_ptr->max_maxhp * 100) m_ptr->dealt_damage = m_ptr->max_maxhp * 100;
1819 msg_format( _("¹ç·×%d/%d¤Î¥À¥á¡¼¥¸¤òÍ¿¤¨¤¿¡£","You do %d (out of %d) damage."),
1820 m_ptr->dealt_damage, m_ptr->maxhp);
1823 /* It is dead now */
1828 if (r_info[m_ptr->r_idx].flags7 & RF7_TANUKI)
1830 /* You might have unmasked Tanuki first time */
1831 r_ptr = &r_info[m_ptr->r_idx];
1832 m_ptr->ap_r_idx = m_ptr->r_idx;
1833 if (r_ptr->r_sights < MAX_SHORT) r_ptr->r_sights++;
1836 if (m_ptr->mflag2 & MFLAG2_CHAMELEON)
1838 /* You might have unmasked Chameleon first time */
1839 r_ptr = real_r_ptr(m_ptr);
1840 if (r_ptr->r_sights < MAX_SHORT) r_ptr->r_sights++;
1843 if (!(m_ptr->smart & SM_CLONED))
1845 /* When the player kills a Unique, it stays dead */
1846 if (r_ptr->flags1 & RF1_UNIQUE)
1850 /* Mega-Hack -- Banor & Lupart */
1851 if ((m_ptr->r_idx == MON_BANOR) || (m_ptr->r_idx == MON_LUPART))
1853 r_info[MON_BANORLUPART].max_num = 0;
1854 r_info[MON_BANORLUPART].r_pkills++;
1855 r_info[MON_BANORLUPART].r_akills++;
1856 if (r_info[MON_BANORLUPART].r_tkills < MAX_SHORT) r_info[MON_BANORLUPART].r_tkills++;
1858 else if (m_ptr->r_idx == MON_BANORLUPART)
1860 r_info[MON_BANOR].max_num = 0;
1861 r_info[MON_BANOR].r_pkills++;
1862 r_info[MON_BANOR].r_akills++;
1863 if (r_info[MON_BANOR].r_tkills < MAX_SHORT) r_info[MON_BANOR].r_tkills++;
1864 r_info[MON_LUPART].max_num = 0;
1865 r_info[MON_LUPART].r_pkills++;
1866 r_info[MON_LUPART].r_akills++;
1867 if (r_info[MON_LUPART].r_tkills < MAX_SHORT) r_info[MON_LUPART].r_tkills++;
1871 /* When the player kills a Nazgul, it stays dead */
1872 else if (r_ptr->flags7 & RF7_NAZGUL) r_ptr->max_num--;
1875 /* Count all monsters killed */
1876 if (r_ptr->r_akills < MAX_SHORT) r_ptr->r_akills++;
1878 /* Recall even invisible uniques or winners */
1879 if ((m_ptr->ml && !p_ptr->image) || (r_ptr->flags1 & RF1_UNIQUE))
1881 /* Count kills this life */
1882 if ((m_ptr->mflag2 & MFLAG2_KAGE) && (r_info[MON_KAGE].r_pkills < MAX_SHORT)) r_info[MON_KAGE].r_pkills++;
1883 else if (r_ptr->r_pkills < MAX_SHORT) r_ptr->r_pkills++;
1885 /* Count kills in all lives */
1886 if ((m_ptr->mflag2 & MFLAG2_KAGE) && (r_info[MON_KAGE].r_tkills < MAX_SHORT)) r_info[MON_KAGE].r_tkills++;
1887 else if (r_ptr->r_tkills < MAX_SHORT) r_ptr->r_tkills++;
1889 /* Hack -- Auto-recall */
1890 monster_race_track(m_ptr->ap_r_idx);
1893 /* Extract monster name */
1894 monster_desc(m_name, m_ptr, MD_TRUE_NAME);
1896 /* Don't kill Amberites */
1897 if ((r_ptr->flags3 & RF3_AMBERITE) && one_in_(2))
1899 int curses = 1 + randint1(3);
1900 bool stop_ty = FALSE;
1904 msg_format("%^s¤Ï¶²¤í¤·¤¤·ì¤Î¼ö¤¤¤ò¤¢¤Ê¤¿¤Ë¤«¤±¤¿¡ª", m_name);
1906 msg_format("%^s puts a terrible blood curse on you!", m_name);
1909 curse_equipment(100, 50);
1913 stop_ty = activate_ty_curse(stop_ty, &count);
1918 if (r_ptr->flags2 & RF2_CAN_SPEAK)
1920 char line_got[1024];
1922 /* Dump a message */
1924 if (!get_rnd_line("mondeath_j.txt", m_ptr->r_idx, line_got))
1926 if (!get_rnd_line("mondeath.txt", m_ptr->r_idx, line_got))
1929 msg_format("%^s %s", m_name, line_got);
1932 if (m_ptr->r_idx == MON_SERPENT)
1934 /* Make screen dump */
1935 screen_dump = make_screen_dump();
1940 if (!(d_info[dungeon_type].flags1 & DF1_BEGINNER))
1942 if (!dun_level && !ambush_flag && !p_ptr->inside_arena)
1944 chg_virtue(V_VALOUR, -1);
1946 else if (r_ptr->level > dun_level)
1948 if (randint1(10) <= (r_ptr->level - dun_level))
1949 chg_virtue(V_VALOUR, 1);
1951 if (r_ptr->level > 60)
1953 chg_virtue(V_VALOUR, 1);
1955 if (r_ptr->level >= 2 * (p_ptr->lev+1))
1956 chg_virtue(V_VALOUR, 2);
1959 if (r_ptr->flags1 & RF1_UNIQUE)
1961 if (r_ptr->flags3 & (RF3_EVIL | RF3_GOOD)) chg_virtue(V_HARMONY, 2);
1963 if (r_ptr->flags3 & RF3_GOOD)
1965 chg_virtue(V_UNLIFE, 2);
1966 chg_virtue(V_VITALITY, -2);
1969 if (one_in_(3)) chg_virtue(V_INDIVIDUALISM, -1);
1972 if (m_ptr->r_idx == MON_BEGGAR || m_ptr->r_idx == MON_LEPER)
1974 chg_virtue(V_COMPASSION, -1);
1977 if ((r_ptr->flags3 & RF3_GOOD) &&
1978 ((r_ptr->level) / 10 + (3 * dun_level) >= randint1(100)))
1979 chg_virtue(V_UNLIFE, 1);
1981 if (r_ptr->d_char == 'A')
1983 if (r_ptr->flags1 & RF1_UNIQUE)
1984 chg_virtue(V_FAITH, -2);
1985 else if ((r_ptr->level) / 10 + (3 * dun_level) >= randint1(100))
1987 if (r_ptr->flags3 & RF3_GOOD) chg_virtue(V_FAITH, -1);
1988 else chg_virtue(V_FAITH, 1);
1991 else if (r_ptr->flags3 & RF3_DEMON)
1993 if (r_ptr->flags1 & RF1_UNIQUE)
1994 chg_virtue(V_FAITH, 2);
1995 else if ((r_ptr->level) / 10 + (3 * dun_level) >= randint1(100))
1996 chg_virtue(V_FAITH, 1);
1999 if ((r_ptr->flags3 & RF3_UNDEAD) && (r_ptr->flags1 & RF1_UNIQUE))
2000 chg_virtue(V_VITALITY, 2);
2002 if (r_ptr->r_deaths)
2004 if (r_ptr->flags1 & RF1_UNIQUE)
2006 chg_virtue(V_HONOUR, 10);
2008 else if ((r_ptr->level) / 10 + (2 * dun_level) >= randint1(100))
2010 chg_virtue(V_HONOUR, 1);
2013 if ((r_ptr->flags2 & RF2_MULTIPLY) && (r_ptr->r_akills > 1000) && one_in_(10))
2015 chg_virtue(V_VALOUR, -1);
2018 for (i = 0; i < 4; i++)
2020 if (r_ptr->blow[i].d_dice != 0) innocent = FALSE; /* Murderer! */
2022 if ((r_ptr->blow[i].effect == RBE_EAT_ITEM)
2023 || (r_ptr->blow[i].effect == RBE_EAT_GOLD))
2025 thief = TRUE; /* Thief! */
2028 /* The new law says it is illegal to live in the dungeon */
2029 if (r_ptr->level != 0) innocent = FALSE;
2033 if (r_ptr->flags1 & RF1_UNIQUE)
2034 chg_virtue(V_JUSTICE, 3);
2035 else if (1+((r_ptr->level) / 10 + (2 * dun_level))
2037 chg_virtue(V_JUSTICE, 1);
2041 chg_virtue (V_JUSTICE, -1);
2044 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)))
2046 if (one_in_(4)) chg_virtue(V_NATURE, -1);
2049 if ((r_ptr->flags1 & RF1_UNIQUE) && record_destroy_uniq)
2053 sprintf(note_buf, "%s%s", r_name + r_ptr->name, (m_ptr->smart & SM_CLONED) ? "(¥¯¥í¡¼¥ó)" : "");
2055 sprintf(note_buf, "%s%s", r_name + r_ptr->name, (m_ptr->smart & SM_CLONED) ? "(Clone)" : "");
2057 do_cmd_write_nikki(NIKKI_UNIQUE, 0, note_buf);
2063 /* Death by Missile/Spell attack */
2066 msg_format("%^s%s", m_name, note);
2069 /* Death by physical attack -- invisible monster */
2070 else if (!m_ptr->ml)
2073 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
2074 msg_format("¤»¤Ã¤«¤¯¤À¤«¤é%s¤ò»¦¤·¤¿¡£", m_name);
2076 msg_format("%s¤ò»¦¤·¤¿¡£", m_name);
2078 msg_format("You have killed %s.", m_name);
2083 /* Death by Physical attack -- non-living monster */
2084 else if (!monster_living(r_ptr))
2087 bool explode = FALSE;
2089 for (i = 0; i < 4; i++)
2091 if (r_ptr->blow[i].method == RBM_EXPLODE) explode = TRUE;
2094 /* Special note at death */
2097 msg_format("%s¤ÏÇúȯ¤·¤ÆÊ´¡¹¤Ë¤Ê¤Ã¤¿¡£", m_name);
2099 msg_format("%^s explodes into tiny shreds.", m_name);
2104 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
2105 msg_format("¤»¤Ã¤«¤¯¤À¤«¤é%s¤òÅݤ·¤¿¡£", m_name);
2107 msg_format("%s¤òÅݤ·¤¿¡£", m_name);
2109 msg_format("You have destroyed %s.", m_name);
2114 /* Death by Physical attack -- living monster */
2118 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
2119 msg_format("¤»¤Ã¤«¤¯¤À¤«¤é%s¤òÁò¤êµî¤Ã¤¿¡£", m_name);
2121 msg_format("%s¤òÁò¤êµî¤Ã¤¿¡£", m_name);
2123 msg_format("You have slain %s.", m_name);
2127 if ((r_ptr->flags1 & RF1_UNIQUE) && !(m_ptr->smart & SM_CLONED) && !vanilla_town)
2129 for (i = 0; i < MAX_KUBI; i++)
2131 if ((kubi_r_idx[i] == m_ptr->r_idx) && !(m_ptr->mflag2 & MFLAG2_CHAMELEON))
2134 msg_format("%s¤Î¼ó¤Ë¤Ï¾Þ¶â¤¬¤«¤«¤Ã¤Æ¤¤¤ë¡£", m_name);
2136 msg_format("There is a price on %s's head.", m_name);
2143 /* Generate treasure */
2144 monster_death(m_idx, TRUE);
2146 /* Mega hack : replace IKETA to BIKETAL */
2147 if ((m_ptr->r_idx == MON_IKETA) &&
2148 !(p_ptr->inside_arena || p_ptr->inside_battle))
2150 int dummy_y = m_ptr->fy;
2151 int dummy_x = m_ptr->fx;
2154 if (is_pet(m_ptr)) mode |= PM_FORCE_PET;
2156 /* Delete the monster */
2157 delete_monster_idx(m_idx);
2159 if (summon_named_creature(0, dummy_y, dummy_x, MON_BIKETAL, mode))
2162 msg_print("¡Ö¥Ï¥¡¥Ã¥Ï¥Ã¥Ï¥Ã¥Ï¡ª¡ª»ä¤¬¥Ð¥¤¥±¥¿¥ë¤À¡ª¡ª¡×");
2164 msg_print("Uwa-hahaha! *I* am Biketal!");
2170 /* Delete the monster */
2171 delete_monster_idx(m_idx);
2174 get_exp_from_mon((long)exp_mon.max_maxhp*2, &exp_mon);
2179 /* Monster is dead */
2186 /* Mega-Hack -- Pain cancels fear */
2187 if (MON_MONFEAR(m_ptr) && (dam > 0))
2190 if (set_monster_monfear(m_idx, MON_MONFEAR(m_ptr) - randint1(dam)))
2197 /* Sometimes a monster gets scared by damage */
2198 if (!MON_MONFEAR(m_ptr) && !(r_ptr->flags3 & (RF3_NO_FEAR)))
2200 /* Percentage of fully healthy */
2201 int percentage = (100L * m_ptr->hp) / m_ptr->maxhp;
2204 * Run (sometimes) if at 10% or less of max hit points,
2205 * or (usually) when hit for half its current hit points
2207 if ((randint1(10) >= percentage) ||
2208 ((dam >= m_ptr->hp) && (randint0(100) < 80)))
2210 /* Hack -- note fear */
2213 /* XXX XXX XXX Hack -- Add some timed fear */
2214 (void)set_monster_monfear(m_idx, (randint1(10) +
2215 (((dam >= m_ptr->hp) && (percentage > 7)) ?
2216 20 : ((11 - percentage) * 5))));
2223 if (p_ptr->riding && (p_ptr->riding == m_idx) && (dam > 0))
2227 /* Extract monster name */
2228 monster_desc(m_name, m_ptr, 0);
2230 if (m_ptr->hp > m_ptr->maxhp/3) dam = (dam + 1) / 2;
2231 if (rakuba((dam > 200) ? 200 : dam, FALSE))
2234 msg_format("%^s¤Ë¿¶¤êÍî¤È¤µ¤ì¤¿¡ª", m_name);
2236 msg_format("%^s has thrown you off!", m_name);
2248 * Get term size and calculate screen size
2250 void get_screen_size(int *wid_p, int *hgt_p)
2252 Term_get_size(wid_p, hgt_p);
2253 *hgt_p -= ROW_MAP + 2;
2254 *wid_p -= COL_MAP + 2;
2255 if (use_bigtile) *wid_p /= 2;
2260 * Calculates current boundaries
2261 * Called below and from "do_cmd_locate()".
2263 void panel_bounds_center(void)
2268 get_screen_size(&wid, &hgt);
2270 panel_row_max = panel_row_min + hgt - 1;
2271 panel_row_prt = panel_row_min - 1;
2272 panel_col_max = panel_col_min + wid - 1;
2273 panel_col_prt = panel_col_min - 13;
2278 * Map resizing whenever the main term changes size
2280 void resize_map(void)
2282 /* Only if the dungeon exists */
2283 if (!character_dungeon) return;
2285 /* Mega-Hack -- no panel yet */
2289 /* Reset the panels */
2290 panel_row_min = cur_hgt;
2291 panel_col_min = cur_wid;
2296 p_ptr->update |= (PU_TORCH | PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
2298 /* Forget lite/view */
2299 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
2301 /* Update lite/view */
2302 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
2304 /* Update monsters */
2305 p_ptr->update |= (PU_MONSTERS);
2307 /* Redraw everything */
2308 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
2310 /* Hack -- update */
2318 * Place the cursor on the player
2320 if (can_save) move_cursor_relative(py, px);
2327 * Redraw a term when it is resized
2329 void redraw_window(void)
2331 /* Only if the dungeon exists */
2332 if (!character_dungeon) return;
2335 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
2338 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
2340 /* Hack -- update */
2349 * Handle a request to change the current panel
2351 * Return TRUE if the panel was changed.
2353 * Also used in do_cmd_locate
2355 bool change_panel(int dy, int dx)
2361 get_screen_size(&wid, &hgt);
2363 /* Apply the motion */
2364 y = panel_row_min + dy * hgt / 2;
2365 x = panel_col_min + dx * wid / 2;
2367 /* Verify the row */
2368 if (y > cur_hgt - hgt) y = cur_hgt - hgt;
2371 /* Verify the col */
2372 if (x > cur_wid - wid) x = cur_wid - wid;
2375 /* Handle "changes" */
2376 if ((y != panel_row_min) || (x != panel_col_min))
2378 /* Save the new panel info */
2382 /* Recalculate the boundaries */
2383 panel_bounds_center();
2386 p_ptr->update |= (PU_MONSTERS);
2389 p_ptr->redraw |= (PR_MAP);
2402 bool change_panel_xy(int y, int x)
2408 get_screen_size(&wid, &hgt);
2410 if (y < panel_row_min) dy = -1;
2411 if (y > panel_row_max) dy = 1;
2412 if (x < panel_col_min) dx = -1;
2413 if (x > panel_col_max) dx = 1;
2415 if (!dy && !dx) return (FALSE);
2417 return change_panel(dy, dx);
2422 * Given an row (y) and col (x), this routine detects when a move
2423 * off the screen has occurred and figures new borders. -RAK-
2425 * "Update" forces a "full update" to take place.
2427 * The map is reprinted if necessary, and "TRUE" is returned.
2429 void verify_panel(void)
2441 get_screen_size(&wid, &hgt);
2443 max_prow_min = cur_hgt - hgt;
2444 max_pcol_min = cur_wid - wid;
2446 /* Bounds checking */
2447 if (max_prow_min < 0) max_prow_min = 0;
2448 if (max_pcol_min < 0) max_pcol_min = 0;
2450 /* Center on player */
2451 if (center_player && (center_running || !running))
2453 /* Center vertically */
2454 prow_min = y - hgt / 2;
2455 if (prow_min < 0) prow_min = 0;
2456 else if (prow_min > max_prow_min) prow_min = max_prow_min;
2458 /* Center horizontally */
2459 pcol_min = x - wid / 2;
2460 if (pcol_min < 0) pcol_min = 0;
2461 else if (pcol_min > max_pcol_min) pcol_min = max_pcol_min;
2465 prow_min = panel_row_min;
2466 pcol_min = panel_col_min;
2468 /* Scroll screen when 2 grids from top/bottom edge */
2469 if (y > panel_row_max - 2)
2471 while (y > prow_min + hgt-1 - 2)
2473 prow_min += (hgt / 2);
2477 if (y < panel_row_min + 2)
2479 while (y < prow_min + 2)
2481 prow_min -= (hgt / 2);
2485 if (prow_min > max_prow_min) prow_min = max_prow_min;
2486 if (prow_min < 0) prow_min = 0;
2488 /* Scroll screen when 4 grids from left/right edge */
2489 if (x > panel_col_max - 4)
2491 while (x > pcol_min + wid-1 - 4)
2493 pcol_min += (wid / 2);
2497 if (x < panel_col_min + 4)
2499 while (x < pcol_min + 4)
2501 pcol_min -= (wid / 2);
2505 if (pcol_min > max_pcol_min) pcol_min = max_pcol_min;
2506 if (pcol_min < 0) pcol_min = 0;
2509 /* Check for "no change" */
2510 if ((prow_min == panel_row_min) && (pcol_min == panel_col_min)) return;
2512 /* Save the new panel info */
2513 panel_row_min = prow_min;
2514 panel_col_min = pcol_min;
2516 /* Hack -- optional disturb on "panel change" */
2517 if (disturb_panel && !center_player) disturb(0, 0);
2519 /* Recalculate the boundaries */
2520 panel_bounds_center();
2523 p_ptr->update |= (PU_MONSTERS);
2526 p_ptr->redraw |= (PR_MAP);
2529 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
2534 * Monster health description
2536 cptr look_mon_desc(monster_type *m_ptr, u32b mode)
2538 monster_race *ap_r_ptr = &r_info[m_ptr->ap_r_idx];
2545 /* Determine if the monster is "living" */
2546 living = monster_living(ap_r_ptr);
2548 /* Calculate a health "percentage" */
2549 perc = 100L * m_ptr->hp / m_ptr->maxhp;
2551 /* Healthy monsters */
2552 if (m_ptr->hp >= m_ptr->maxhp)
2556 desc = living ? "̵½ý" : "̵¥À¥á¡¼¥¸";
2558 desc = living ? "unhurt" : "undamaged";
2563 else if (perc >= 60)
2566 desc = living ? "·Ú½ý" : "¾®¥À¥á¡¼¥¸";
2568 desc = living ? "somewhat wounded" : "somewhat damaged";
2573 else if (perc >= 25)
2576 desc = living ? "Éé½ý" : "Ãæ¥À¥á¡¼¥¸";
2578 desc = living ? "wounded" : "damaged";
2583 else if (perc >= 10)
2586 desc = living ? "½Å½ý" : "Âç¥À¥á¡¼¥¸";
2588 desc = living ? "badly wounded" : "badly damaged";
2596 desc = living ? "Ⱦ»àȾÀ¸" : "Åݤ줫¤±";
2598 desc = living ? "almost dead" : "almost destroyed";
2603 /* Need attitude information? */
2606 /* Full information is not needed */
2609 else if (is_pet(m_ptr))
2612 attitude = ", ¥Ú¥Ã¥È";
2617 else if (is_friendly(m_ptr))
2620 attitude = ", ͧ¹¥Åª";
2622 attitude = ", friendly";
2635 /* Clone monster? */
2636 if (m_ptr->smart & SM_CLONED)
2645 /* Display monster's level --- idea borrowed from ToME */
2646 if (ap_r_ptr->r_tkills && !(m_ptr->mflag2 & MFLAG2_KAGE))
2649 return format("¥ì¥Ù¥ë%d, %s%s%s", ap_r_ptr->level, desc, attitude, clone);
2651 return format("Level %d, %s%s%s", ap_r_ptr->level, desc, attitude, clone);
2657 return format("¥ì¥Ù¥ë???, %s%s%s", desc, attitude, clone);
2659 return format("Level ???, %s%s%s", desc, attitude, clone);
2667 * Angband sorting algorithm -- quick sort in place
2669 * Note that the details of the data we are sorting is hidden,
2670 * and we rely on the "ang_sort_comp()" and "ang_sort_swap()"
2671 * function hooks to interact with the data, which is given as
2672 * two pointers, and which may have any user-defined form.
2674 void ang_sort_aux(vptr u, vptr v, int p, int q)
2692 while (!(*ang_sort_comp)(u, v, b, z)) b--;
2695 while (!(*ang_sort_comp)(u, v, z, a)) a++;
2697 /* Done partition */
2701 (*ang_sort_swap)(u, v, a, b);
2707 /* Recurse left side */
2708 ang_sort_aux(u, v, p, b);
2710 /* Recurse right side */
2711 ang_sort_aux(u, v, b+1, q);
2716 * Angband sorting algorithm -- quick sort in place
2718 * Note that the details of the data we are sorting is hidden,
2719 * and we rely on the "ang_sort_comp()" and "ang_sort_swap()"
2720 * function hooks to interact with the data, which is given as
2721 * two pointers, and which may have any user-defined form.
2723 void ang_sort(vptr u, vptr v, int n)
2725 /* Sort the array */
2726 ang_sort_aux(u, v, 0, n-1);
2731 /*** Targeting Code ***/
2735 * Determine is a monster makes a reasonable target
2737 * The concept of "targeting" was stolen from "Morgul" (?)
2739 * The player can target any location, or any "target-able" monster.
2741 * Currently, a monster is "target_able" if it is visible, and if
2742 * the player can hit it with a projection, and the player is not
2743 * hallucinating. This allows use of "use closest target" macros.
2745 * Future versions may restrict the ability to target "trappers"
2746 * and "mimics", but the semantics is a little bit weird.
2748 bool target_able(int m_idx)
2750 monster_type *m_ptr = &m_list[m_idx];
2752 /* Monster must be alive */
2753 if (!m_ptr->r_idx) return (FALSE);
2755 /* Hack -- no targeting hallucinations */
2756 if (p_ptr->image) return (FALSE);
2758 /* Monster must be visible */
2759 if (!m_ptr->ml) return (FALSE);
2761 if (p_ptr->riding && (p_ptr->riding == m_idx)) return (TRUE);
2763 /* Monster must be projectable */
2764 if (!projectable(py, px, m_ptr->fy, m_ptr->fx)) return (FALSE);
2766 /* XXX XXX XXX Hack -- Never target trappers */
2767 /* if (CLEAR_ATTR && (CLEAR_CHAR)) return (FALSE); */
2777 * Update (if necessary) and verify (if possible) the target.
2779 * We return TRUE if the target is "okay" and FALSE otherwise.
2781 bool target_okay(void)
2783 /* Accept stationary targets */
2784 if (target_who < 0) return (TRUE);
2786 /* Check moving targets */
2789 /* Accept reasonable targets */
2790 if (target_able(target_who))
2792 monster_type *m_ptr = &m_list[target_who];
2794 /* Acquire monster location */
2795 target_row = m_ptr->fy;
2796 target_col = m_ptr->fx;
2803 /* Assume no target */
2809 * Sorting hook -- comp function -- by "distance to player"
2811 * We use "u" and "v" to point to arrays of "x" and "y" positions,
2812 * and sort the arrays by double-distance to the player.
2814 static bool ang_sort_comp_distance(vptr u, vptr v, int a, int b)
2816 byte *x = (byte*)(u);
2817 byte *y = (byte*)(v);
2821 /* Absolute distance components */
2822 kx = x[a]; kx -= px; kx = ABS(kx);
2823 ky = y[a]; ky -= py; ky = ABS(ky);
2825 /* Approximate Double Distance to the first point */
2826 da = ((kx > ky) ? (kx + kx + ky) : (ky + ky + kx));
2828 /* Absolute distance components */
2829 kx = x[b]; kx -= px; kx = ABS(kx);
2830 ky = y[b]; ky -= py; ky = ABS(ky);
2832 /* Approximate Double Distance to the first point */
2833 db = ((kx > ky) ? (kx + kx + ky) : (ky + ky + kx));
2835 /* Compare the distances */
2841 * Sorting hook -- comp function -- by importance level of grids
2843 * We use "u" and "v" to point to arrays of "x" and "y" positions,
2844 * and sort the arrays by level of monster
2846 static bool ang_sort_comp_importance(vptr u, vptr v, int a, int b)
2848 byte *x = (byte*)(u);
2849 byte *y = (byte*)(v);
2850 cave_type *ca_ptr = &cave[y[a]][x[a]];
2851 cave_type *cb_ptr = &cave[y[b]][x[b]];
2852 monster_type *ma_ptr = &m_list[ca_ptr->m_idx];
2853 monster_type *mb_ptr = &m_list[cb_ptr->m_idx];
2854 monster_race *ap_ra_ptr, *ap_rb_ptr;
2856 /* The player grid */
2857 if (y[a] == py && x[a] == px) return TRUE;
2858 if (y[b] == py && x[b] == px) return FALSE;
2860 /* Extract monster race */
2861 if (ca_ptr->m_idx && ma_ptr->ml) ap_ra_ptr = &r_info[ma_ptr->ap_r_idx];
2862 else ap_ra_ptr = NULL;
2863 if (cb_ptr->m_idx && mb_ptr->ml) ap_rb_ptr = &r_info[mb_ptr->ap_r_idx];
2864 else ap_rb_ptr = NULL;
2866 if (ap_ra_ptr && !ap_rb_ptr) return TRUE;
2867 if (!ap_ra_ptr && ap_rb_ptr) return FALSE;
2869 /* Compare two monsters */
2870 if (ap_ra_ptr && ap_rb_ptr)
2872 /* Unique monsters first */
2873 if ((ap_ra_ptr->flags1 & RF1_UNIQUE) && !(ap_rb_ptr->flags1 & RF1_UNIQUE)) return TRUE;
2874 if (!(ap_ra_ptr->flags1 & RF1_UNIQUE) && (ap_rb_ptr->flags1 & RF1_UNIQUE)) return FALSE;
2876 /* Shadowers first (¤¢¤ä¤·¤¤±Æ) */
2877 if ((ma_ptr->mflag2 & MFLAG2_KAGE) && !(mb_ptr->mflag2 & MFLAG2_KAGE)) return TRUE;
2878 if (!(ma_ptr->mflag2 & MFLAG2_KAGE) && (mb_ptr->mflag2 & MFLAG2_KAGE)) return FALSE;
2880 /* Unknown monsters first */
2881 if (!ap_ra_ptr->r_tkills && ap_rb_ptr->r_tkills) return TRUE;
2882 if (ap_ra_ptr->r_tkills && !ap_rb_ptr->r_tkills) return FALSE;
2884 /* Higher level monsters first (if known) */
2885 if (ap_ra_ptr->r_tkills && ap_rb_ptr->r_tkills)
2887 if (ap_ra_ptr->level > ap_rb_ptr->level) return TRUE;
2888 if (ap_ra_ptr->level < ap_rb_ptr->level) return FALSE;
2891 /* Sort by index if all conditions are same */
2892 if (ma_ptr->ap_r_idx > mb_ptr->ap_r_idx) return TRUE;
2893 if (ma_ptr->ap_r_idx < mb_ptr->ap_r_idx) return FALSE;
2896 /* An object get higher priority */
2897 if (cave[y[a]][x[a]].o_idx && !cave[y[b]][x[b]].o_idx) return TRUE;
2898 if (!cave[y[a]][x[a]].o_idx && cave[y[b]][x[b]].o_idx) return FALSE;
2900 /* Priority from the terrain */
2901 if (f_info[ca_ptr->feat].priority > f_info[cb_ptr->feat].priority) return TRUE;
2902 if (f_info[ca_ptr->feat].priority < f_info[cb_ptr->feat].priority) return FALSE;
2904 /* If all conditions are same, compare distance */
2905 return ang_sort_comp_distance(u, v, a, b);
2910 * Sorting hook -- swap function -- by "distance to player"
2912 * We use "u" and "v" to point to arrays of "x" and "y" positions,
2913 * and sort the arrays by distance to the player.
2915 static void ang_sort_swap_distance(vptr u, vptr v, int a, int b)
2917 byte *x = (byte*)(u);
2918 byte *y = (byte*)(v);
2936 * Hack -- help "select" a location (see below)
2938 static s16b target_pick(int y1, int x1, int dy, int dx)
2942 int x2, y2, x3, y3, x4, y4;
2944 int b_i = -1, b_v = 9999;
2947 /* Scan the locations */
2948 for (i = 0; i < temp_n; i++)
2954 /* Directed distance */
2958 /* Verify quadrant */
2959 if (dx && (x3 * dx <= 0)) continue;
2960 if (dy && (y3 * dy <= 0)) continue;
2962 /* Absolute distance */
2966 /* Verify quadrant */
2967 if (dy && !dx && (x4 > y4)) continue;
2968 if (dx && !dy && (y4 > x4)) continue;
2970 /* Approximate Double Distance */
2971 v = ((x4 > y4) ? (x4 + x4 + y4) : (y4 + y4 + x4));
2973 /* XXX XXX XXX Penalize location */
2976 if ((b_i >= 0) && (v >= b_v)) continue;
2988 * Hack -- determine if a given location is "interesting"
2990 static bool target_set_accept(int y, int x)
2994 s16b this_o_idx, next_o_idx = 0;
2997 if (!(in_bounds(y, x))) return (FALSE);
2999 /* Player grid is always interesting */
3000 if (player_bold(y, x)) return (TRUE);
3003 /* Handle hallucination */
3004 if (p_ptr->image) return (FALSE);
3007 /* Examine the grid */
3008 c_ptr = &cave[y][x];
3010 /* Visible monsters */
3013 monster_type *m_ptr = &m_list[c_ptr->m_idx];
3015 /* Visible monsters */
3016 if (m_ptr->ml) return (TRUE);
3019 /* Scan all objects in the grid */
3020 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
3024 /* Acquire object */
3025 o_ptr = &o_list[this_o_idx];
3027 /* Acquire next object */
3028 next_o_idx = o_ptr->next_o_idx;
3030 /* Memorized object */
3031 if (o_ptr->marked & OM_FOUND) return (TRUE);
3034 /* Interesting memorized features */
3035 if (c_ptr->info & (CAVE_MARK))
3037 /* Notice object features */
3038 if (c_ptr->info & CAVE_OBJECT) return (TRUE);
3040 /* Feature code (applying "mimic" field) */
3041 if (have_flag(f_info[get_feat_mimic(c_ptr)].flags, FF_NOTICE)) return TRUE;
3050 * Prepare the "temp" array for "target_set"
3052 * Return the number of target_able monsters in the set.
3054 static void target_set_prepare(int mode)
3057 int min_hgt, max_hgt, min_wid, max_wid;
3059 if (mode & TARGET_KILL)
3062 min_hgt = MAX((py - MAX_RANGE), 0);
3063 max_hgt = MIN((py + MAX_RANGE), cur_hgt - 1);
3064 min_wid = MAX((px - MAX_RANGE), 0);
3065 max_wid = MIN((px + MAX_RANGE), cur_wid - 1);
3067 else /* not targetting */
3070 min_hgt = panel_row_min;
3071 max_hgt = panel_row_max;
3072 min_wid = panel_col_min;
3073 max_wid = panel_col_max;
3076 /* Reset "temp" array */
3079 /* Scan the current panel */
3080 for (y = min_hgt; y <= max_hgt; y++)
3082 for (x = min_wid; x <= max_wid; x++)
3086 /* Require "interesting" contents */
3087 if (!target_set_accept(y, x)) continue;
3089 c_ptr = &cave[y][x];
3091 /* Require target_able monsters for "TARGET_KILL" */
3092 if ((mode & (TARGET_KILL)) && !target_able(c_ptr->m_idx)) continue;
3094 if ((mode & (TARGET_KILL)) && !target_pet && is_pet(&m_list[c_ptr->m_idx])) continue;
3096 /* Save the location */
3103 /* Set the sort hooks */
3104 if (mode & (TARGET_KILL))
3106 /* Target the nearest monster for shooting */
3107 ang_sort_comp = ang_sort_comp_distance;
3108 ang_sort_swap = ang_sort_swap_distance;
3112 /* Look important grids first in Look command */
3113 ang_sort_comp = ang_sort_comp_importance;
3114 ang_sort_swap = ang_sort_swap_distance;
3117 /* Sort the positions */
3118 ang_sort(temp_x, temp_y, temp_n);
3120 if (p_ptr->riding && target_pet && (temp_n > 1) && (mode & (TARGET_KILL)))
3125 temp_y[0] = temp_y[1];
3128 temp_x[0] = temp_x[1];
3132 void target_set_prepare_look(){
3133 target_set_prepare(TARGET_LOOK);
3138 * Evaluate number of kill needed to gain level
3140 static void evaluate_monster_exp(char *buf, monster_type *m_ptr)
3142 monster_race *ap_r_ptr = &r_info[m_ptr->ap_r_idx];
3144 s32b exp_mon, exp_adv;
3145 u32b exp_mon_frac, exp_adv_frac;
3147 if ((p_ptr->lev >= PY_MAX_LEVEL) || (p_ptr->prace == RACE_ANDROID))
3152 else if (!ap_r_ptr->r_tkills || (m_ptr->mflag2 & MFLAG2_KAGE))
3162 /* The monster's experience point (assuming average monster speed) */
3163 exp_mon = ap_r_ptr->mexp * ap_r_ptr->level;
3165 s64b_div(&exp_mon, &exp_mon_frac, 0, (p_ptr->max_plv + 2));
3168 /* Total experience value for next level */
3169 exp_adv = player_exp[p_ptr->lev -1] * p_ptr->expfact;
3171 s64b_div(&exp_adv, &exp_adv_frac, 0, 100);
3173 /* Experience value need to get */
3174 s64b_sub(&exp_adv, &exp_adv_frac, p_ptr->exp, p_ptr->exp_frac);
3177 /* You need to kill at least one monster to get any experience */
3178 s64b_add(&exp_adv, &exp_adv_frac, exp_mon, exp_mon_frac);
3179 s64b_sub(&exp_adv, &exp_adv_frac, 0, 1);
3181 /* Extract number of monsters needed */
3182 s64b_div(&exp_adv, &exp_adv_frac, exp_mon, exp_mon_frac);
3184 /* If 999 or more monsters needed, only display "999". */
3185 num = MIN(999, exp_adv_frac);
3187 /* Display the number */
3188 sprintf(buf,"%03ld", (long int)num);
3192 bool show_gold_on_floor = FALSE;
3195 * Examine a grid, return a keypress.
3197 * The "mode" argument contains the "TARGET_LOOK" bit flag, which
3198 * indicates that the "space" key should scan through the contents
3199 * of the grid, instead of simply returning immediately. This lets
3200 * the "look" command get complete information, without making the
3201 * "target" command annoying.
3203 * The "info" argument contains the "commands" which should be shown
3204 * inside the "[xxx]" text. This string must never be empty, or grids
3205 * containing monsters will be displayed with an extra comma.
3207 * Note that if a monster is in the grid, we update both the monster
3208 * recall info and the health bar info to track that monster.
3210 * Eventually, we may allow multiple objects per grid, or objects
3211 * and terrain features in the same grid. XXX XXX XXX
3213 * This function must handle blindness/hallucination.
3215 static int target_set_aux(int y, int x, int mode, cptr info)
3217 cave_type *c_ptr = &cave[y][x];
3218 s16b this_o_idx, next_o_idx = 0;
3219 cptr s1 = "", s2 = "", s3 = "", x_info = "";
3222 feature_type *f_ptr;
3224 char out_val[MAX_NLEN+80];
3226 #ifdef ALLOW_EASY_FLOOR
3227 int floor_list[23], floor_num = 0;
3229 /* Scan all objects in the grid */
3232 floor_num = scan_floor(floor_list, y, x, 0x02);
3244 #endif /* ALLOW_EASY_FLOOR */
3246 /* Hack -- under the player */
3247 if (player_bold(y, x))
3270 /* Hack -- hallucination */
3274 cptr name = "²¿¤«´ñ̯¤Êʪ";
3276 cptr name = "something strange";
3280 /* Display a message */
3282 sprintf(out_val, "%s%s%s%s [%s]", s1, name, s2, s3, info);
3284 sprintf(out_val, "%s%s%s%s [%s]", s1, s2, s3, name, info);
3288 move_cursor_relative(y, x);
3291 /* Stop on everything but "return" */
3292 if ((query != '\r') && (query != '\n')) return query;
3294 /* Repeat forever */
3299 /* Actual monsters */
3300 if (c_ptr->m_idx && m_list[c_ptr->m_idx].ml)
3302 monster_type *m_ptr = &m_list[c_ptr->m_idx];
3303 monster_race *ap_r_ptr = &r_info[m_ptr->ap_r_idx];
3305 bool recall = FALSE;
3310 /* Get the monster name ("a kobold") */
3311 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
3313 /* Hack -- track this monster race */
3314 monster_race_track(m_ptr->ap_r_idx);
3316 /* Hack -- health bar for this monster */
3317 health_track(c_ptr->m_idx);
3319 /* Hack -- handle stuff */
3333 /* Recall on screen */
3334 screen_roff(m_ptr->ap_r_idx, 0);
3336 /* Hack -- Complete the prompt (again) */
3338 Term_addstr(-1, TERM_WHITE, format(" [r»× %s%s]", x_info, info));
3340 Term_addstr(-1, TERM_WHITE, format(" [r,%s%s]", x_info, info));
3349 /* Normal commands */
3350 if (query != 'r') break;
3355 /* Cleare recall text and repeat */
3361 /* Describe, and prompt for recall */
3362 evaluate_monster_exp(acount, m_ptr);
3365 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);
3367 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);
3373 move_cursor_relative(y, x);
3378 /* Normal commands */
3379 if (query != 'r') break;
3385 /* Always stop at "normal" keys */
3386 if ((query != '\r') && (query != '\n') && (query != ' ') && (query != 'x')) return query;
3388 /* Sometimes stop at "space" key */
3389 if ((query == ' ') && !(mode & (TARGET_LOOK))) return query;
3391 /* Change the intro */
3399 /* Hack -- take account of gender */
3401 if (ap_r_ptr->flags1 & (RF1_FEMALE)) s1 = "Èà½÷¤Ï";
3403 if (ap_r_ptr->flags1 & (RF1_FEMALE)) s1 = "She is ";
3407 else if (ap_r_ptr->flags1 & (RF1_MALE)) s1 = "Èà¤Ï";
3409 else if (ap_r_ptr->flags1 & (RF1_MALE)) s1 = "He is ";
3413 /* Use a preposition */
3422 /* Scan all objects being carried */
3423 for (this_o_idx = m_ptr->hold_o_idx; this_o_idx; this_o_idx = next_o_idx)
3425 char o_name[MAX_NLEN];
3429 /* Acquire object */
3430 o_ptr = &o_list[this_o_idx];
3432 /* Acquire next object */
3433 next_o_idx = o_ptr->next_o_idx;
3435 /* Obtain an object description */
3436 object_desc(o_name, o_ptr, 0);
3438 /* Describe the object */
3440 sprintf(out_val, "%s%s%s%s[%s]", s1, o_name, s2, s3, info);
3442 sprintf(out_val, "%s%s%s%s [%s]", s1, s2, s3, o_name, info);
3446 move_cursor_relative(y, x);
3449 /* Always stop at "normal" keys */
3450 if ((query != '\r') && (query != '\n') && (query != ' ') && (query != 'x')) return query;
3452 /* Sometimes stop at "space" key */
3453 if ((query == ' ') && !(mode & (TARGET_LOOK))) return query;
3455 /* Change the intro */
3459 s2 = "also carrying ";
3463 /* Use a preposition */
3473 #ifdef ALLOW_EASY_FLOOR
3482 char o_name[MAX_NLEN];
3486 /* Acquire object */
3487 o_ptr = &o_list[floor_list[0]];
3489 /* Describe the object */
3490 object_desc(o_name, o_ptr, 0);
3494 sprintf(out_val, "%s%s%s%s[%s]",
3495 s1, o_name, s2, s3, info);
3497 sprintf(out_val, "%s%s%s%s [%s]",
3498 s1, s2, s3, o_name, info);
3502 move_cursor_relative(y, x);
3511 /* Provide one cushion before item listing */
3514 /* Display rough information about items */
3516 sprintf(out_val, "%s %d¸Ä¤Î¥¢¥¤¥Æ¥à%s%s ['x'¤Ç°ìÍ÷, %s]",
3517 s1, floor_num, s2, s3, info);
3519 sprintf(out_val, "%s%s%sa pile of %d items [x,%s]",
3520 s1, s2, s3, floor_num, info);
3524 move_cursor_relative(y, x);
3529 /* No request for listing */
3530 if (query != 'x' && query != ' ') return query;
3534 /** Display list of items **/
3536 /* Continue scrolling list if requested */
3545 show_gold_on_floor = TRUE;
3546 (void)show_floor(0, y, x, &min_width);
3547 show_gold_on_floor = FALSE;
3551 sprintf(out_val, "%s %d¸Ä¤Î¥¢¥¤¥Æ¥à%s%s [Enter¤Ç¼¡¤Ø, %s]",
3552 s1, floor_num, s2, s3, info);
3554 sprintf(out_val, "%s%s%sa pile of %d items [Enter,%s]",
3555 s1, s2, s3, floor_num, info);
3566 /* Exit unless 'Enter' */
3567 if (query != '\n' && query != '\r')
3572 /* Get the object being moved. */
3573 o_idx = c_ptr->o_idx;
3575 /* Only rotate a pile of two or more objects. */
3576 if (!(o_idx && o_list[o_idx].next_o_idx)) continue;
3578 /* Remove the first object from the list. */
3579 excise_object_idx(o_idx);
3581 /* Find end of the list. */
3583 while (o_list[i].next_o_idx)
3584 i = o_list[i].next_o_idx;
3586 /* Add after the last object. */
3587 o_list[i].next_o_idx = o_idx;
3589 /* Loop and re-display the list */
3595 #endif /* ALLOW_EASY_FLOOR */
3598 /* Scan all objects in the grid */
3599 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
3603 /* Acquire object */
3604 o_ptr = &o_list[this_o_idx];
3606 /* Acquire next object */
3607 next_o_idx = o_ptr->next_o_idx;
3610 if (o_ptr->marked & OM_FOUND)
3612 char o_name[MAX_NLEN];
3617 /* Obtain an object description */
3618 object_desc(o_name, o_ptr, 0);
3620 /* Describe the object */
3622 sprintf(out_val, "%s%s%s%s[%s]", s1, o_name, s2, s3, info);
3624 sprintf(out_val, "%s%s%s%s [%s]", s1, s2, s3, o_name, info);
3628 move_cursor_relative(y, x);
3631 /* Always stop at "normal" keys */
3632 if ((query != '\r') && (query != '\n') && (query != ' ') && (query != 'x')) return query;
3634 /* Sometimes stop at "space" key */
3635 if ((query == ' ') && !(mode & TARGET_LOOK)) return query;
3637 /* Change the intro */
3647 if (o_ptr->number != 1) s1 = "¤½¤ì¤é¤Ï";
3649 if (o_ptr->number != 1) s1 = "They are ";
3665 /* Feature code (applying "mimic" field) */
3666 feat = get_feat_mimic(c_ptr);
3668 /* Require knowledge about grid, or ability to see grid */
3669 if (!(c_ptr->info & CAVE_MARK) && !player_can_see_bold(y, x))
3671 /* Forget feature */
3675 f_ptr = &f_info[feat];
3677 /* Terrain feature if needed */
3678 if (boring || have_flag(f_ptr->flags, FF_REMEMBER))
3682 /* Hack -- special handling for quest entrances */
3683 if (have_flag(f_ptr->flags, FF_QUEST_ENTER))
3685 /* Set the quest number temporary */
3686 int old_quest = p_ptr->inside_quest;
3689 /* Clear the text */
3690 for (j = 0; j < 10; j++) quest_text[j][0] = '\0';
3691 quest_text_line = 0;
3693 p_ptr->inside_quest = c_ptr->special;
3695 /* Get the quest text */
3696 init_flags = INIT_NAME_ONLY;
3698 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
3701 name = format("¥¯¥¨¥¹¥È¡Ö%s¡×(%d³¬ÁêÅö)", quest[c_ptr->special].name, quest[c_ptr->special].level);
3703 name = format("the entrance to the quest '%s'(level %d)", quest[c_ptr->special].name, quest[c_ptr->special].level);
3706 /* Reset the old quest number */
3707 p_ptr->inside_quest = old_quest;
3710 /* Hack -- special handling for building doors */
3711 else if (have_flag(f_ptr->flags, FF_BLDG) && !p_ptr->inside_arena)
3713 name = building[f_ptr->subtype].name;
3715 else if (have_flag(f_ptr->flags, FF_ENTRANCE))
3718 name = format("%s(%d³¬ÁêÅö)", d_text + d_info[c_ptr->special].text, d_info[c_ptr->special].mindepth);
3720 name = format("%s(level %d)", d_text + d_info[c_ptr->special].text, d_info[c_ptr->special].mindepth);
3723 else if (have_flag(f_ptr->flags, FF_TOWN))
3725 name = town[c_ptr->special].name;
3727 else if (p_ptr->wild_mode && (feat == feat_floor))
3737 name = f_name + f_ptr->name;
3743 ((!have_flag(f_ptr->flags, FF_MOVE) && !have_flag(f_ptr->flags, FF_CAN_FLY)) ||
3744 (!have_flag(f_ptr->flags, FF_LOS) && !have_flag(f_ptr->flags, FF_TREE)) ||
3745 have_flag(f_ptr->flags, FF_TOWN)))
3754 /* Hack -- special introduction for store & building doors -KMW- */
3755 if (have_flag(f_ptr->flags, FF_STORE) ||
3756 have_flag(f_ptr->flags, FF_QUEST_ENTER) ||
3757 (have_flag(f_ptr->flags, FF_BLDG) && !p_ptr->inside_arena) ||
3758 have_flag(f_ptr->flags, FF_ENTRANCE))
3767 else if (have_flag(f_ptr->flags, FF_FLOOR) ||
3768 have_flag(f_ptr->flags, FF_TOWN) ||
3769 have_flag(f_ptr->flags, FF_SHALLOW) ||
3770 have_flag(f_ptr->flags, FF_DEEP))
3776 /* Pick proper indefinite article */
3777 s3 = (is_a_vowel(name[0])) ? "an " : "a ";
3781 /* Display a message */
3785 if (c_ptr->mimic) sprintf(f_idx_str, "%d/%d", c_ptr->feat, c_ptr->mimic);
3786 else sprintf(f_idx_str, "%d", c_ptr->feat);
3788 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]);
3790 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);
3795 sprintf(out_val, "%s%s%s%s[%s]", s1, name, s2, s3, info);
3797 sprintf(out_val, "%s%s%s%s [%s]", s1, s2, s3, name, info);
3801 move_cursor_relative(y, x);
3804 /* Always stop at "normal" keys */
3805 if ((query != '\r') && (query != '\n') && (query != ' ')) return query;
3808 /* Stop on everything but "return" */
3809 if ((query != '\r') && (query != '\n')) return query;
3811 /* Repeat forever */
3817 * Handle "target" and "look".
3819 * Note that this code can be called from "get_aim_dir()".
3821 * All locations must be on the current panel. Consider the use of
3822 * "panel_bounds()" to allow "off-panel" targets, perhaps by using
3823 * some form of "scrolling" the map around the cursor. XXX XXX XXX
3824 * That is, consider the possibility of "auto-scrolling" the screen
3825 * while the cursor moves around. This may require changes in the
3826 * "update_mon()" code to allow "visibility" even if off panel, and
3827 * may require dynamic recalculation of the "temp" grid set.
3829 * Hack -- targeting/observing an "outer border grid" may induce
3830 * problems, so this is not currently allowed.
3832 * The player can use the direction keys to move among "interesting"
3833 * grids in a heuristic manner, or the "space", "+", and "-" keys to
3834 * move through the "interesting" grids in a sequential manner, or
3835 * can enter "location" mode, and use the direction keys to move one
3836 * grid at a time in any direction. The "t" (set target) command will
3837 * only target a monster (as opposed to a location) if the monster is
3838 * target_able and the "interesting" mode is being used.
3840 * The current grid is described using the "look" method above, and
3841 * a new command may be entered at any time, but note that if the
3842 * "TARGET_LOOK" bit flag is set (or if we are in "location" mode,
3843 * where "space" has no obvious meaning) then "space" will scan
3844 * through the description of the current grid until done, instead
3845 * of immediately jumping to the next "interesting" grid. This
3846 * allows the "target" command to retain its old semantics.
3848 * The "*", "+", and "-" keys may always be used to jump immediately
3849 * to the next (or previous) interesting grid, in the proper mode.
3851 * The "return" key may always be used to scan through a complete
3852 * grid description (forever).
3854 * This command will cancel any old target, even if used from
3855 * inside the "look" command.
3857 bool target_set(int mode)
3876 get_screen_size(&wid, &hgt);
3882 /* Cancel tracking */
3883 /* health_track(0); */
3886 /* Prepare the "temp" array */
3887 target_set_prepare(mode);
3889 /* Start near the player */
3895 /* Interesting grids */
3902 change_panel_xy(y, x);
3904 if (!(mode & TARGET_LOOK)) prt_path(y, x);
3907 c_ptr = &cave[y][x];
3910 if (target_able(c_ptr->m_idx))
3913 strcpy(info, "q»ß t·è p¼« o¸½ +¼¡ -Á°");
3915 strcpy(info, "q,t,p,o,+,-,<dir>");
3920 /* Dis-allow target */
3924 strcpy(info, "q»ß p¼« o¸½ +¼¡ -Á°");
3926 strcpy(info, "q,p,o,+,-,<dir>");
3931 /* Describe and Prompt */
3933 query = target_set_aux(y, x, mode, info);
3937 /* Cancel tracking */
3938 /* health_track(0); */
3940 /* Assume no "direction" */
3945 if (query == '\r') query = 't';
3963 if (target_able(c_ptr->m_idx))
3965 health_track(c_ptr->m_idx);
3966 target_who = c_ptr->m_idx;
3985 if (!expand_list) done = TRUE;
3995 if (!expand_list) done = TRUE;
4002 /* Recenter the map around the player */
4006 p_ptr->update |= (PU_MONSTERS);
4009 p_ptr->redraw |= (PR_MAP);
4012 p_ptr->window |= (PW_OVERHEAD);
4017 /* Recalculate interesting grids */
4018 target_set_prepare(mode);
4037 /* Extract the action (if any) */
4038 d = get_keymap_dir(query);
4045 /* Hack -- move around */
4048 /* Modified to scroll to monster */
4049 int y2 = panel_row_min;
4050 int x2 = panel_col_min;
4052 /* Find a new monster */
4053 i = target_pick(temp_y[m], temp_x[m], ddy[d], ddx[d]);
4055 /* Request to target past last interesting grid */
4056 while (flag && (i < 0))
4058 /* Note the change */
4059 if (change_panel(ddy[d], ddx[d]))
4064 /* Recalculate interesting grids */
4065 target_set_prepare(mode);
4067 /* Look at interesting grids */
4070 /* Find a new monster */
4071 i = target_pick(v, u, ddy[d], ddx[d]);
4077 /* Nothing interesting */
4083 /* Restore previous position */
4086 panel_bounds_center();
4089 p_ptr->update |= (PU_MONSTERS);
4092 p_ptr->redraw |= (PR_MAP);
4095 p_ptr->window |= (PW_OVERHEAD);
4100 /* Recalculate interesting grids */
4101 target_set_prepare(mode);
4103 /* Look at boring grids */
4110 /* Do not move horizontally if unnecessary */
4111 if (((x < panel_col_min + wid / 2) && (dx > 0)) ||
4112 ((x > panel_col_min + wid / 2) && (dx < 0)))
4117 /* Do not move vertically if unnecessary */
4118 if (((y < panel_row_min + hgt / 2) && (dy > 0)) ||
4119 ((y > panel_row_min + hgt / 2) && (dy < 0)))
4124 /* Apply the motion */
4125 if ((y >= panel_row_min+hgt) || (y < panel_row_min) ||
4126 (x >= panel_col_min+wid) || (x < panel_col_min))
4128 if (change_panel(dy, dx)) target_set_prepare(mode);
4131 /* Slide into legality */
4132 if (x >= cur_wid-1) x = cur_wid - 2;
4133 else if (x <= 0) x = 1;
4135 /* Slide into legality */
4136 if (y >= cur_hgt-1) y = cur_hgt- 2;
4137 else if (y <= 0) y = 1;
4146 /* Arbitrary grids */
4149 bool move_fast = FALSE;
4151 if (!(mode & TARGET_LOOK)) prt_path(y, x);
4154 c_ptr = &cave[y][x];
4156 /* Default prompt */
4158 strcpy(info, "q»ß t·è p¼« m¶á +¼¡ -Á°");
4160 strcpy(info, "q,t,p,m,+,-,<dir>");
4164 /* Describe and Prompt (enable "TARGET_LOOK") */
4165 while (!(query = target_set_aux(y, x, mode | TARGET_LOOK, info)));
4167 /* Cancel tracking */
4168 /* health_track(0); */
4170 /* Assume no direction */
4175 if (query == '\r') query = 't';
4178 /* Analyze the keypress */
4202 /* Recenter the map around the player */
4206 p_ptr->update |= (PU_MONSTERS);
4209 p_ptr->redraw |= (PR_MAP);
4212 p_ptr->window |= (PW_OVERHEAD);
4217 /* Recalculate interesting grids */
4218 target_set_prepare(mode);
4240 /* Pick a nearby monster */
4241 for (i = 0; i < temp_n; i++)
4243 t = distance(y, x, temp_y[i], temp_x[i]);
4253 /* Nothing interesting */
4254 if (bd == 999) flag = FALSE;
4261 /* Extract the action (if any) */
4262 d = get_keymap_dir(query);
4264 /* XTRA HACK MOVEFAST */
4265 if (isupper(query)) move_fast = TRUE;
4272 /* Handle "direction" */
4278 /* XTRA HACK MOVEFAST */
4281 int mag = MIN(wid / 2, hgt / 2);
4291 /* Do not move horizontally if unnecessary */
4292 if (((x < panel_col_min + wid / 2) && (dx > 0)) ||
4293 ((x > panel_col_min + wid / 2) && (dx < 0)))
4298 /* Do not move vertically if unnecessary */
4299 if (((y < panel_row_min + hgt / 2) && (dy > 0)) ||
4300 ((y > panel_row_min + hgt / 2) && (dy < 0)))
4305 /* Apply the motion */
4306 if ((y >= panel_row_min + hgt) || (y < panel_row_min) ||
4307 (x >= panel_col_min + wid) || (x < panel_col_min))
4309 if (change_panel(dy, dx)) target_set_prepare(mode);
4312 /* Slide into legality */
4313 if (x >= cur_wid-1) x = cur_wid - 2;
4314 else if (x <= 0) x = 1;
4316 /* Slide into legality */
4317 if (y >= cur_hgt-1) y = cur_hgt- 2;
4318 else if (y <= 0) y = 1;
4326 /* Clear the top line */
4329 /* Recenter the map around the player */
4333 p_ptr->update |= (PU_MONSTERS);
4336 p_ptr->redraw |= (PR_MAP);
4339 p_ptr->window |= (PW_OVERHEAD);
4344 /* Failure to set target */
4345 if (!target_who) return (FALSE);
4353 * Get an "aiming direction" from the user.
4355 * The "dir" is loaded with 1,2,3,4,6,7,8,9 for "actual direction", and
4356 * "0" for "current target", and "-1" for "entry aborted".
4358 * Note that "Force Target", if set, will pre-empt user interaction,
4359 * if there is a usable target already set.
4361 * Note that confusion over-rides any (explicit?) user choice.
4363 bool get_aim_dir(int *dp)
4374 /* Global direction */
4377 /* Hack -- auto-target if requested */
4378 if (use_old_target && target_okay()) dir = 5;
4380 #ifdef ALLOW_REPEAT /* TNB */
4382 if (repeat_pull(dp))
4387 if (!(*dp == 5 && !target_okay()))
4389 /* return (TRUE); */
4394 #endif /* ALLOW_REPEAT -- TNB */
4396 /* Ask until satisfied */
4399 /* Choose a prompt */
4403 p = "Êý¸þ ('*'¤Ç¥¿¡¼¥²¥Ã¥ÈÁªÂò, ESC¤ÇÃæÃÇ)? ";
4405 p = "Direction ('*' to choose a target, Escape to cancel)? ";
4412 p = "Êý¸þ ('5'¤Ç¥¿¡¼¥²¥Ã¥È¤Ø, '*'¤Ç¥¿¡¼¥²¥Ã¥ÈºÆÁªÂò, ESC¤ÇÃæÃÇ)? ";
4414 p = "Direction ('5' for target, '*' to re-target, Escape to cancel)? ";
4419 /* Get a command (or Cancel) */
4420 if (!get_com(p, &command, TRUE)) break;
4424 if (command == '\r') command = 't';
4427 /* Convert various keys to "standard" keys */
4430 /* Use current target */
4441 /* Set new target */
4446 if (target_set(TARGET_KILL)) dir = 5;
4452 /* Extract the action (if any) */
4453 dir = get_keymap_dir(command);
4459 /* Verify requested targets */
4460 if ((dir == 5) && !target_okay()) dir = 0;
4469 project_length = 0; /* reset to default */
4473 /* Save the direction */
4476 /* Check for confusion */
4477 if (p_ptr->confused)
4480 /* Random direction */
4481 dir = ddd[randint0(8)];
4484 /* Notice confusion */
4485 if (command_dir != dir)
4489 msg_print("¤¢¤Ê¤¿¤Ïº®Í𤷤Ƥ¤¤ë¡£");
4491 msg_print("You are confused.");
4496 /* Save direction */
4499 #ifdef ALLOW_REPEAT /* TNB */
4501 /* repeat_push(dir); */
4502 repeat_push(command_dir);
4504 #endif /* ALLOW_REPEAT -- TNB */
4506 /* A "valid" direction was entered */
4513 * Request a "movement" direction (1,2,3,4,6,7,8,9) from the user,
4514 * and place it into "command_dir", unless we already have one.
4516 * This function should be used for all "repeatable" commands, such as
4517 * run, walk, open, close, bash, disarm, spike, tunnel, etc, as well
4518 * as all commands which must reference a grid adjacent to the player,
4519 * and which may not reference the grid under the player. Note that,
4520 * for example, it is no longer possible to "disarm" or "open" chests
4521 * in the same grid as the player.
4523 * Direction "5" is illegal and will (cleanly) abort the command.
4525 * This function tracks and uses the "global direction", and uses
4526 * that as the "desired direction", to which "confusion" is applied.
4528 bool get_rep_dir(int *dp, bool under)
4536 /* Global direction */
4539 #ifdef ALLOW_REPEAT /* TNB */
4541 if (repeat_pull(dp))
4544 /* return (TRUE); */
4547 #endif /* ALLOW_REPEAT -- TNB */
4551 prompt = _("Êý¸þ ('.'¸µ, ESC¤ÇÃæÃÇ)? ", "Direction ('.' at feet, Escape to cancel)? ");
4555 prompt = _("Êý¸þ (ESC¤ÇÃæÃÇ)? ", "Direction (Escape to cancel)? ");
4558 /* Get a direction */
4563 /* Get a command (or Cancel) */
4564 if (!get_com(prompt, &ch, TRUE)) break;
4567 if ((under) && ((ch == '5') || (ch == '-') || (ch == '.')))
4573 /* Look up the direction */
4574 dir = get_keymap_dir(ch);
4581 /* Prevent weirdness */
4582 if ((dir == 5) && (!under)) dir = 0;
4585 if (!dir) return (FALSE);
4587 /* Save desired direction */
4590 /* Apply "confusion" */
4591 if (p_ptr->confused)
4593 /* Standard confusion */
4594 if (randint0(100) < 75)
4596 /* Random direction */
4597 dir = ddd[randint0(8)];
4600 else if (p_ptr->riding)
4602 monster_type *m_ptr = &m_list[p_ptr->riding];
4603 monster_race *r_ptr = &r_info[m_ptr->r_idx];
4605 if (MON_CONFUSED(m_ptr))
4607 /* Standard confusion */
4608 if (randint0(100) < 75)
4610 /* Random direction */
4611 dir = ddd[randint0(8)];
4614 else if ((r_ptr->flags1 & RF1_RAND_50) && (r_ptr->flags1 & RF1_RAND_25) && (randint0(100) < 50))
4616 /* Random direction */
4617 dir = ddd[randint0(8)];
4619 else if ((r_ptr->flags1 & RF1_RAND_50) && (randint0(100) < 25))
4621 /* Random direction */
4622 dir = ddd[randint0(8)];
4626 /* Notice confusion */
4627 if (command_dir != dir)
4629 if (p_ptr->confused)
4633 msg_print("¤¢¤Ê¤¿¤Ïº®Í𤷤Ƥ¤¤ë¡£");
4635 msg_print("You are confused.");
4641 monster_type *m_ptr = &m_list[p_ptr->riding];
4643 monster_desc(m_name, m_ptr, 0);
4644 if (MON_CONFUSED(m_ptr))
4647 msg_format("%s¤Ïº®Í𤷤Ƥ¤¤ë¡£", m_name);
4649 msg_format("%^s is confusing.", m_name);
4656 msg_format("%s¤Ï»×¤¤Ä̤ê¤ËÆ°¤¤¤Æ¤¯¤ì¤Ê¤¤¡£", m_name);
4658 msg_format("You cannot control %s.", m_name);
4664 /* Save direction */
4667 #ifdef ALLOW_REPEAT /* TNB */
4669 /* repeat_push(dir); */
4670 repeat_push(command_dir);
4672 #endif /* ALLOW_REPEAT -- TNB */
4679 bool get_rep_dir2(int *dp)
4686 /* Global direction */
4689 #ifdef ALLOW_REPEAT /* TNB */
4691 if (repeat_pull(dp))
4694 /* return (TRUE); */
4697 #endif /* ALLOW_REPEAT -- TNB */
4699 /* Get a direction */
4704 /* Get a command (or Cancel) */
4706 if (!get_com("Êý¸þ (ESC¤ÇÃæÃÇ)? ", &ch, TRUE)) break;
4708 if (!get_com("Direction (Escape to cancel)? ", &ch, TRUE)) break;
4712 /* Look up the direction */
4713 dir = get_keymap_dir(ch);
4719 /* Prevent weirdness */
4720 if (dir == 5) dir = 0;
4723 if (!dir) return (FALSE);
4725 /* Save desired direction */
4728 /* Apply "confusion" */
4729 if (p_ptr->confused)
4731 /* Standard confusion */
4732 if (randint0(100) < 75)
4734 /* Random direction */
4735 dir = ddd[randint0(8)];
4739 /* Notice confusion */
4740 if (command_dir != dir)
4744 msg_print("¤¢¤Ê¤¿¤Ïº®Í𤷤Ƥ¤¤ë¡£");
4746 msg_print("You are confused.");
4751 /* Save direction */
4754 #ifdef ALLOW_REPEAT /* TNB */
4756 /* repeat_push(dir); */
4757 repeat_push(command_dir);
4759 #endif /* ALLOW_REPEAT -- TNB */
4765 void gain_level_reward(int chosen_reward)
4769 char wrath_reason[32] = "";
4770 int nasty_chance = 6;
4771 int dummy = 0, dummy2 = 0;
4774 char o_name[MAX_NLEN];
4780 if (multi_rew) return;
4781 else multi_rew = TRUE;
4785 if (p_ptr->lev == 13) nasty_chance = 2;
4786 else if (!(p_ptr->lev % 13)) nasty_chance = 3;
4787 else if (!(p_ptr->lev % 14)) nasty_chance = 12;
4789 if (one_in_(nasty_chance))
4790 type = randint1(20); /* Allow the 'nasty' effects */
4792 type = randint1(15) + 5; /* Or disallow them */
4794 if (type < 1) type = 1;
4795 if (type > 20) type = 20;
4800 sprintf(wrath_reason, "%s¤ÎÅܤê",
4801 chaos_patrons[p_ptr->chaos_patron]);
4803 sprintf(wrath_reason, "the Wrath of %s",
4804 chaos_patrons[p_ptr->chaos_patron]);
4808 effect = chaos_rewards[p_ptr->chaos_patron][type];
4810 if (one_in_(6) && !chosen_reward)
4813 msg_format("%^s¤ÏË«Èþ¤È¤·¤Æ¤¢¤Ê¤¿¤òÆÍÁ³ÊÑ°Û¤µ¤»¤¿¡£",
4814 chaos_patrons[p_ptr->chaos_patron]);
4816 msg_format("%^s rewards you with a mutation!",
4817 chaos_patrons[p_ptr->chaos_patron]);
4820 (void)gain_random_mutation(0);
4822 reward = "ÊÑ°Û¤·¤¿¡£";
4824 reward = "mutation";
4829 switch (chosen_reward ? chosen_reward : effect)
4833 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
4834 chaos_patrons[p_ptr->chaos_patron]);
4836 msg_format("The voice of %s booms out:",
4837 chaos_patrons[p_ptr->chaos_patron]);
4841 msg_print("¡ÖÆò¡¢¿·¤¿¤Ê¤ë»Ñ¤òɬÍפȤ»¤ê¡ª¡×");
4843 msg_print("'Thou needst a new form, mortal!'");
4848 reward = "ÊÑ°Û¤·¤¿¡£";
4850 reward = "polymorphing";
4855 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
4856 chaos_patrons[p_ptr->chaos_patron]);
4858 msg_format("The voice of %s booms out:",
4859 chaos_patrons[p_ptr->chaos_patron]);
4863 msg_print("¡ÖÆò¤ÏÎɤ¯¹Ô¤¤¤¿¤ê¡ªÂ³¤±¤è¡ª¡×");
4865 msg_print("'Well done, mortal! Lead on!'");
4868 if (p_ptr->prace == RACE_ANDROID)
4871 msg_print("¤·¤«¤·²¿¤âµ¯¤³¤é¤Ê¤«¤Ã¤¿¡£");
4873 msg_print("But, nothing happen.");
4876 else if (p_ptr->exp < PY_MAX_EXP)
4878 s32b ee = (p_ptr->exp / 2) + 10;
4879 if (ee > 100000L) ee = 100000L;
4881 msg_print("¹¹¤Ë·Ð¸³¤òÀѤó¤À¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£");
4883 msg_print("You feel more experienced.");
4888 reward = "·Ð¸³ÃͤòÆÀ¤¿";
4890 reward = "experience";
4896 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
4897 chaos_patrons[p_ptr->chaos_patron]);
4899 msg_format("The voice of %s booms out:",
4900 chaos_patrons[p_ptr->chaos_patron]);
4904 msg_print("¡Ö²¼Ëͤ衢Æò¤½¤ì¤ËÃͤ»¤º¡£¡×");
4906 msg_print("'Thou didst not deserve that, slave.'");
4909 if (p_ptr->prace == RACE_ANDROID)
4912 msg_print("¤·¤«¤·²¿¤âµ¯¤³¤é¤Ê¤«¤Ã¤¿¡£");
4914 msg_print("But, nothing happen.");
4919 lose_exp(p_ptr->exp / 6);
4921 reward = "·Ð¸³Ãͤò¼º¤Ã¤¿¡£";
4923 reward = "losing experience";
4929 msg_format("%s¤ÎÀ¼¤¬¤µ¤µ¤ä¤¤¤¿:",
4930 chaos_patrons[p_ptr->chaos_patron]);
4932 msg_format("The voice of %s whispers:",
4933 chaos_patrons[p_ptr->chaos_patron]);
4937 msg_print("¡Ö²æ¤¬Í¿¤¨¤·Êª¤ò¸ÌÀ¤Ë»È¤¦¤Ù¤·¡£¡×");
4939 msg_print("'Use my gift wisely.'");
4942 acquirement(py, px, 1, FALSE, FALSE);
4944 reward = "¾å¼Á¤Ê¥¢¥¤¥Æ¥à¤ò¼ê¤ËÆþ¤ì¤¿¡£";
4946 reward = "a good item";
4951 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
4952 chaos_patrons[p_ptr->chaos_patron]);
4954 msg_format("The voice of %s booms out:",
4955 chaos_patrons[p_ptr->chaos_patron]);
4959 msg_print("¡Ö²æ¤¬Í¿¤¨¤·Êª¤ò¸ÌÀ¤Ë»È¤¦¤Ù¤·¡£¡×");
4961 msg_print("'Use my gift wisely.'");
4964 acquirement(py, px, 1, TRUE, FALSE);
4966 reward = "¹âµéÉʤΥ¢¥¤¥Æ¥à¤ò¼ê¤ËÆþ¤ì¤¿¡£";
4968 reward = "an excellent item";
4973 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
4974 chaos_patrons[p_ptr->chaos_patron]);
4976 msg_format("The voice of %s booms out:",
4977 chaos_patrons[p_ptr->chaos_patron]);
4981 msg_print("¡ÖÆò¤Î¹Ô¤¤¤Ïµ®¤·õ¤ËÃͤ»¤ê¡£¡×");
4983 msg_print("'Thy deed hath earned thee a worthy blade.'");
4986 /* Get local object */
4989 switch (randint1(p_ptr->lev))
4995 dummy2 = SV_MAIN_GAUCHE;
5004 dummy2 = SV_SMALL_SWORD;
5007 dummy2 = SV_BASILLARD;
5009 case 11: case 12: case 13:
5010 dummy2 = SV_SHORT_SWORD;
5016 dummy2 = SV_CUTLASS;
5019 dummy2 = SV_WAKIZASHI;
5022 dummy2 = SV_KHOPESH;
5028 dummy2 = SV_BROAD_SWORD;
5031 dummy2 = SV_LONG_SWORD;
5034 dummy2 = SV_SCIMITAR;
5037 dummy2 = SV_NINJATO;
5043 dummy2 = SV_BASTARD_SWORD;
5046 dummy2 = SV_GREAT_SCIMITAR;
5049 dummy2 = SV_CLAYMORE;
5052 dummy2 = SV_ESPADON;
5055 dummy2 = SV_TWO_HANDED_SWORD;
5058 dummy2 = SV_FLAMBERGE;
5061 dummy2 = SV_NO_DACHI;
5064 dummy2 = SV_EXECUTIONERS_SWORD;
5067 dummy2 = SV_ZWEIHANDER;
5070 dummy2 = SV_HAYABUSA;
5073 dummy2 = SV_BLADE_OF_CHAOS;
5076 object_prep(q_ptr, lookup_kind(dummy, dummy2));
5077 q_ptr->to_h = 3 + randint1(dun_level) % 10;
5078 q_ptr->to_d = 3 + randint1(dun_level) % 10;
5079 one_resistance(q_ptr);
5080 q_ptr->name2 = EGO_CHAOTIC;
5082 /* Drop it in the dungeon */
5083 (void)drop_near(q_ptr, -1, py, px);
5085 reward = "(º®ÆÙ)¤ÎÉð´ï¤ò¼ê¤ËÆþ¤ì¤¿¡£";
5087 reward = "chaos weapon";
5092 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5093 chaos_patrons[p_ptr->chaos_patron]);
5095 msg_format("The voice of %s booms out:",
5096 chaos_patrons[p_ptr->chaos_patron]);
5100 msg_print("¡ÖÆò¤Î¹Ô¤¤¤Ïµ®¤Ê󤤤ËÃͤ»¤ê¡£¡×");
5102 msg_print("'Thy deed hath earned thee a worthy reward.'");
5105 acquirement(py, px, randint1(2) + 1, FALSE, FALSE);
5107 reward = "¾å¼Á¤Ê¥¢¥¤¥Æ¥à¤ò¼ê¤ËÆþ¤ì¤¿¡£";
5109 reward = "good items";
5114 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5115 chaos_patrons[p_ptr->chaos_patron]);
5117 msg_format("The voice of %s booms out:",
5118 chaos_patrons[p_ptr->chaos_patron]);
5122 msg_print("¡Ö²¼Ëͤ衢Æò¤Î¸¥¿È¤Ø¤Î²æ¤¬Àˤ·¤ß̵¤Ê󤤤ò¸«¤ë¤¬¤è¤¤¡£¡×");
5124 msg_print("'Behold, mortal, how generously I reward thy loyalty.'");
5127 acquirement(py, px, randint1(2) + 1, TRUE, FALSE);
5129 reward = "¹âµéÉʤΥ¢¥¤¥Æ¥à¤ò¼ê¤ËÆþ¤ì¤¿¡£";
5131 reward = "excellent items";
5136 msg_format("%s¤ÎÀ¼¤¬¹ì¤ÅϤä¿:",
5137 chaos_patrons[p_ptr->chaos_patron]);
5139 msg_format("The voice of %s thunders:",
5140 chaos_patrons[p_ptr->chaos_patron]);
5144 msg_print("¡Ö²¼Ëͤ衢ÆòÐþËý¤Ê¤ê¡£¡×");
5146 msg_print("'Thou art growing arrogant, mortal.'");
5149 (void)activate_ty_curse(FALSE, &count);
5151 reward = "²Ò¡¹¤·¤¤¼ö¤¤¤ò¤«¤±¤é¤ì¤¿¡£";
5158 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5159 chaos_patrons[p_ptr->chaos_patron]);
5161 msg_format("The voice of %s booms out:",
5162 chaos_patrons[p_ptr->chaos_patron]);
5166 msg_print("¡Ö²æ¤¬²¼Ëͤ¿¤Á¤è¡¢¤«¤ÎÐþËý¤Ê¤ë¼Ô¤òÅݤ¹¤Ù¤·¡ª¡×");
5168 msg_print("'My pets, destroy the arrogant mortal!'");
5171 for (dummy = 0; dummy < randint1(5) + 1; dummy++)
5173 (void)summon_specific(0, py, px, dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
5176 reward = "¥â¥ó¥¹¥¿¡¼¤ò¾¤´¤µ¤ì¤¿¡£";
5178 reward = "summoning hostile monsters";
5183 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5184 chaos_patrons[p_ptr->chaos_patron]);
5186 msg_format("The voice of %s booms out:",
5187 chaos_patrons[p_ptr->chaos_patron]);
5191 msg_print("¡ÖÆò¡¢¤è¤ê¶¯¤Å¨¤òɬÍפȤ»¤ê¡ª¡×");
5193 msg_print("'Thou needst worthier opponents!'");
5196 activate_hi_summon(py, px, FALSE);
5198 reward = "¥â¥ó¥¹¥¿¡¼¤ò¾¤´¤µ¤ì¤¿¡£";
5200 reward = "summoning many hostile monsters";
5205 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5206 chaos_patrons[p_ptr->chaos_patron]);
5208 msg_format("The voice of %s booms out:",
5209 chaos_patrons[p_ptr->chaos_patron]);
5213 msg_print("¡Ö»à¤ÈÇ˲õ¤³¤½²æ¤¬´î¤Ó¤Ê¤ê¡ª¡×");
5215 msg_print("'Death and destruction! This pleaseth me!'");
5220 reward = "¥«¥ª¥¹¤ÎÎϤ¬±²´¬¤¤¤¿¡£";
5222 reward = "calling chaos";
5227 msg_format("%s¤ÎÀ¼¤¬ÌĤê¶Á¤¤¤¿:",
5228 chaos_patrons[p_ptr->chaos_patron]);
5230 msg_format("The voice of %s rings out:",
5231 chaos_patrons[p_ptr->chaos_patron]);
5235 msg_print("¡Öα¤Þ¤ë¤Î¤À¡¢²¼Ëͤ衣;¤¬Æò¤ÎÆùÂΤòÃ䨤󡣡×");
5237 msg_print("'Stay, mortal, and let me mold thee.'");
5240 if (one_in_(3) && !(chaos_stats[p_ptr->chaos_patron] < 0))
5241 do_inc_stat(chaos_stats[p_ptr->chaos_patron]);
5243 do_inc_stat(randint0(6));
5245 reward = "ǽÎÏÃͤ¬¾å¤¬¤Ã¤¿¡£";
5247 reward = "increasing a stat";
5252 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5253 chaos_patrons[p_ptr->chaos_patron]);
5255 msg_format("The voice of %s booms out:",
5256 chaos_patrons[p_ptr->chaos_patron]);
5260 msg_print("¡Ö²¼Ëͤ衢;¤ÏÆò¤ËË°¤ß¤¿¤ê¡£¡×");
5262 msg_print("'I grow tired of thee, mortal.'");
5265 if (one_in_(3) && !(chaos_stats[p_ptr->chaos_patron] < 0))
5266 do_dec_stat(chaos_stats[p_ptr->chaos_patron]);
5268 (void)do_dec_stat(randint0(6));
5270 reward = "ǽÎÏÃͤ¬²¼¤¬¤Ã¤¿¡£";
5272 reward = "decreasing a stat";
5277 msg_format("%s¤ÎÀ¼¤¬¹ì¤ÅϤä¿:",
5278 chaos_patrons[p_ptr->chaos_patron]);
5280 msg_format("The voice of %s thunders:",
5281 chaos_patrons[p_ptr->chaos_patron]);
5285 msg_print("¡ÖÆò¡¢¸¬µõ¤¿¤ë¤³¤È¤ò³Ø¤Ö¤Ù¤·¡ª¡×");
5286 msg_print("¤¢¤Ê¤¿¤Ï°ÊÁ°¤è¤ê¼å¤¯¤Ê¤Ã¤¿¡ª");
5288 msg_print("'Thou needst a lesson in humility, mortal!'");
5289 msg_print("You feel less powerful!");
5292 for (dummy = 0; dummy < 6; dummy++)
5294 (void)dec_stat(dummy, 10 + randint1(15), TRUE);
5297 reward = "Á´Ç½ÎÏÃͤ¬²¼¤¬¤Ã¤¿¡£";
5299 reward = "decreasing all stats";
5304 msg_format("%s¤ÎÎϤ¬¿¨¤ì¤ë¤Î¤ò´¶¤¸¤¿¡£",
5306 msg_format("You feel the power of %s touch you.",
5309 chaos_patrons[p_ptr->chaos_patron]);
5312 reward = "½ý¤¬ÊѲ½¤·¤¿¡£";
5314 reward = "polymorphing wounds";
5319 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5320 chaos_patrons[p_ptr->chaos_patron]);
5322 msg_format("The voice of %s booms out:",
5323 chaos_patrons[p_ptr->chaos_patron]);
5327 msg_print("¡Ö²æ¤¬¤µ¤µ¤ä¤«¤Ê¤ë»òʪ¤ò¼õ¤±¤È¤ë¤¬¤è¤¤¡ª¡×");
5329 msg_print("'Receive this modest gift from me!'");
5332 for (dummy = 0; dummy < 6; dummy++)
5334 (void)do_inc_stat(dummy);
5337 reward = "Á´Ç½ÎÏÃͤ¬¾å¤¬¤Ã¤¿¡£";
5339 reward = "increasing all stats";
5344 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5345 chaos_patrons[p_ptr->chaos_patron]);
5347 msg_format("The voice of %s booms out:",
5348 chaos_patrons[p_ptr->chaos_patron]);
5352 msg_print("¡Ö¶ì¤·¤à¤¬¤è¤¤¡¢ÌµÇ½¤Ê¶ò¤«¼Ô¤è¡ª¡×");
5354 msg_print("'Suffer, pathetic fool!'");
5357 fire_ball(GF_DISINTEGRATE, 0, p_ptr->lev * 4, 4);
5358 take_hit(DAMAGE_NOESCAPE, p_ptr->lev * 4, wrath_reason, -1);
5360 reward = "ʬ²ò¤Îµå¤¬È¯À¸¤·¤¿¡£";
5362 reward = "generating disintegration ball";
5367 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5368 chaos_patrons[p_ptr->chaos_patron]);
5370 msg_format("The voice of %s booms out:",
5371 chaos_patrons[p_ptr->chaos_patron]);
5375 msg_print("¡Öᴤ뤬¤è¤¤¡¢²æ¤¬²¼Ëͤ衪¡×");
5377 msg_print("'Rise, my servant!'");
5381 (void)set_poisoned(0);
5383 (void)set_confused(0);
5388 for (dummy = 0; dummy < 6; dummy++)
5390 (void)do_res_stat(dummy);
5393 reward = "ÂÎÎϤ¬²óÉü¤·¤¿¡£";
5399 if (!buki_motteruka(INVEN_RARM) && !buki_motteruka(INVEN_LARM)) break;
5401 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5402 chaos_patrons[p_ptr->chaos_patron]);
5404 msg_format("The voice of %s booms out:",
5405 chaos_patrons[p_ptr->chaos_patron]);
5409 msg_print("¡ÖÆò¡¢Éð´ï¤ËÍê¤ë¤³¤È¤Ê¤«¤ì¡£¡×");
5411 msg_print("'Thou reliest too much on thy weapon.'");
5415 if (buki_motteruka(INVEN_LARM))
5418 if (buki_motteruka(INVEN_RARM) && one_in_(2)) dummy = INVEN_RARM;
5420 object_desc(o_name, &inventory[dummy], OD_NAME_ONLY);
5421 (void)curse_weapon(FALSE, dummy);
5423 reward = format("%s¤¬Ç˲õ¤µ¤ì¤¿¡£", o_name);
5425 reward = format("destroying %s", o_name);
5429 if (!inventory[INVEN_BODY].k_idx) break;
5431 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5432 chaos_patrons[p_ptr->chaos_patron]);
5434 msg_format("The voice of %s booms out:",
5435 chaos_patrons[p_ptr->chaos_patron]);
5439 msg_print("¡ÖÆò¡¢Ëɶñ¤ËÍê¤ë¤³¤È¤Ê¤«¤ì¡£¡×");
5441 msg_print("'Thou reliest too much on thine equipment.'");
5444 object_desc(o_name, &inventory[INVEN_BODY], OD_NAME_ONLY);
5445 (void)curse_armor();
5447 reward = format("%s¤¬Ç˲õ¤µ¤ì¤¿¡£", o_name);
5449 reward = format("destroying %s", o_name);
5454 msg_format("%s¤ÎÀ¼¤¬¤µ¤µ¤ä¤¤¤¿:",
5455 chaos_patrons[p_ptr->chaos_patron]);
5457 msg_format("The voice of %s whispers:",
5458 chaos_patrons[p_ptr->chaos_patron]);
5462 msg_print("¡Ö²æ¤òÅܤꤷ¤á¤¿ºá¤ò½þ¤¦¤Ù¤·¡£¡×");
5464 msg_print("'Now thou shalt pay for annoying me.'");
5467 switch (randint1(4))
5470 (void)activate_ty_curse(FALSE, &count);
5472 reward = "²Ò¡¹¤·¤¤¼ö¤¤¤ò¤«¤±¤é¤ì¤¿¡£";
5478 activate_hi_summon(py, px, FALSE);
5480 reward = "¥â¥ó¥¹¥¿¡¼¤ò¾¤´¤µ¤ì¤¿¡£";
5482 reward = "summoning hostile monsters";
5488 if (!buki_motteruka(INVEN_RARM) && !buki_motteruka(INVEN_LARM)) break;
5490 if (buki_motteruka(INVEN_LARM))
5493 if (buki_motteruka(INVEN_RARM) && one_in_(2)) dummy = INVEN_RARM;
5495 object_desc(o_name, &inventory[dummy], OD_NAME_ONLY);
5496 (void)curse_weapon(FALSE, dummy);
5498 reward = format("%s¤¬Ç˲õ¤µ¤ì¤¿¡£", o_name);
5500 reward = format("destroying %s", o_name);
5505 if (!inventory[INVEN_BODY].k_idx) break;
5506 object_desc(o_name, &inventory[INVEN_BODY], OD_NAME_ONLY);
5507 (void)curse_armor();
5509 reward = format("%s¤¬Ç˲õ¤µ¤ì¤¿¡£", o_name);
5511 reward = format("destroying %s", o_name);
5516 for (dummy = 0; dummy < 6; dummy++)
5518 (void)dec_stat(dummy, 10 + randint1(15), TRUE);
5521 reward = "Á´Ç½ÎÏÃͤ¬²¼¤¬¤Ã¤¿¡£";
5523 reward = "decreasing all stats";
5530 msg_format("%s¤ÎÀ¼¤¬¹ì¤ÅϤä¿:",
5532 msg_format("The voice of %s thunders:",
5535 chaos_patrons[p_ptr->chaos_patron]);
5537 msg_print("¡Ö»à¤Ì¤¬¤è¤¤¡¢²¼Ëͤ衪¡×");
5539 msg_print("'Die, mortal!'");
5542 take_hit(DAMAGE_LOSELIFE, p_ptr->lev * 4, wrath_reason, -1);
5543 for (dummy = 0; dummy < 6; dummy++)
5545 (void)dec_stat(dummy, 10 + randint1(15), FALSE);
5547 activate_hi_summon(py, px, FALSE);
5548 (void)activate_ty_curse(FALSE, &count);
5553 if (buki_motteruka(INVEN_RARM))
5556 if (buki_motteruka(INVEN_LARM) && one_in_(2)) dummy = INVEN_LARM;
5558 else if (buki_motteruka(INVEN_LARM)) dummy = INVEN_LARM;
5560 if (dummy) (void)curse_weapon(FALSE, dummy);
5562 if (one_in_(2)) (void)curse_armor();
5566 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5567 chaos_patrons[p_ptr->chaos_patron]);
5569 msg_format("The voice of %s booms out:",
5570 chaos_patrons[p_ptr->chaos_patron]);
5574 msg_print("¡Ö»à¤ÈÇ˲õ¤³¤½²æ¤¬´î¤Ó¤Ê¤ê¡ª¡×");
5576 msg_print("'Death and destruction! This pleaseth me!'");
5579 (void)destroy_area(py, px, 25, FALSE);
5581 reward = "¥À¥ó¥¸¥ç¥ó¤¬*Ç˲õ*¤µ¤ì¤¿¡£";
5583 reward = "*destruct*ing dungeon";
5588 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5589 chaos_patrons[p_ptr->chaos_patron]);
5591 msg_format("The voice of %s booms out:",
5592 chaos_patrons[p_ptr->chaos_patron]);
5596 msg_print("¡Ö²æ¡¢Æò¤ÎŨ¤òËõ»¦¤»¤ó¡ª¡×");
5598 msg_print("'Let me relieve thee of thine oppressors!'");
5601 (void)symbol_genocide(0, FALSE);
5603 reward = "¥â¥ó¥¹¥¿¡¼¤¬Ëõ»¦¤µ¤ì¤¿¡£";
5605 reward = "genociding monsters";
5610 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5611 chaos_patrons[p_ptr->chaos_patron]);
5613 msg_format("The voice of %s booms out:",
5614 chaos_patrons[p_ptr->chaos_patron]);
5618 msg_print("¡Ö²æ¡¢Æò¤ÎŨ¤òËõ»¦¤»¤ó¡ª¡×");
5620 msg_print("'Let me relieve thee of thine oppressors!'");
5623 (void)mass_genocide(0, FALSE);
5625 reward = "¥â¥ó¥¹¥¿¡¼¤¬Ëõ»¦¤µ¤ì¤¿¡£";
5627 reward = "genociding nearby monsters";
5632 msg_format("%s¤ÎÎϤ¬Å¨¤ò¹¶·â¤¹¤ë¤Î¤ò´¶¤¸¤¿¡ª",
5633 chaos_patrons[p_ptr->chaos_patron]);
5635 msg_format("You can feel the power of %s assault your enemies!",
5636 chaos_patrons[p_ptr->chaos_patron]);
5639 (void)dispel_monsters(p_ptr->lev * 4);
5643 msg_format("%s¤Ï¤¢¤Ê¤¿¤ò̵»ë¤·¤¿¡£",
5644 chaos_patrons[p_ptr->chaos_patron]);
5646 msg_format("%s ignores you.",
5647 chaos_patrons[p_ptr->chaos_patron]);
5653 msg_format("%s¤ÏË«Èþ¤È¤·¤Æ°Ëâ¤Î»È¤¤¤ò¤è¤³¤·¤¿¡ª",chaos_patrons[p_ptr->chaos_patron]);
5655 msg_format("%s rewards you with a demonic servant!",chaos_patrons[p_ptr->chaos_patron]);
5658 if (!summon_specific(-1, py, px, dun_level, SUMMON_DEMON, PM_FORCE_PET))
5660 msg_print("²¿¤â¸½¤ì¤Ê¤«¤Ã¤¿...");
5662 msg_print("Nobody ever turns up...");
5666 reward = "°Ë⤬¥Ú¥Ã¥È¤Ë¤Ê¤Ã¤¿¡£";
5668 reward = "a demonic servant";
5674 msg_format("%s¤ÏË«Èþ¤È¤·¤Æ»È¤¤¤ò¤è¤³¤·¤¿¡ª",chaos_patrons[p_ptr->chaos_patron]);
5676 msg_format("%s rewards you with a servant!",chaos_patrons[p_ptr->chaos_patron]);
5679 if (!summon_specific(-1, py, px, dun_level, 0, PM_FORCE_PET))
5681 msg_print("²¿¤â¸½¤ì¤Ê¤«¤Ã¤¿...");
5683 msg_print("Nobody ever turns up...");
5687 reward = "¥â¥ó¥¹¥¿¡¼¤¬¥Ú¥Ã¥È¤Ë¤Ê¤Ã¤¿¡£";
5689 reward = "a servant";
5695 msg_format("%s¤ÏË«Èþ¤È¤·¤Æ¥¢¥ó¥Ç¥Ã¥É¤Î»È¤¤¤ò¤è¤³¤·¤¿¡£",chaos_patrons[p_ptr->chaos_patron]);
5697 msg_format("%s rewards you with an undead servant!",chaos_patrons[p_ptr->chaos_patron]);
5700 if (!summon_specific(-1, py, px, dun_level, SUMMON_UNDEAD, PM_FORCE_PET))
5702 msg_print("²¿¤â¸½¤ì¤Ê¤«¤Ã¤¿...");
5704 msg_print("Nobody ever turns up...");
5708 reward = "¥¢¥ó¥Ç¥Ã¥É¤¬¥Ú¥Ã¥È¤Ë¤Ê¤Ã¤¿¡£";
5710 reward = "an undead servant";
5716 msg_format("%s¤ÎÀ¼¤¬¤É¤â¤Ã¤¿:",
5718 msg_format("The voice of %s stammers:",
5721 chaos_patrons[p_ptr->chaos_patron]);
5723 msg_format("¡Ö¤¢¡¼¡¢¤¢¡¼¡¢Åú¤¨¤Ï %d/%d¡£¼ÁÌä¤Ï²¿¡©¡×", type, effect);
5725 msg_format("'Uh... uh... the answer's %d/%d, what's the question?'", type, effect);
5733 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, format("¥Ñ¥È¥í¥ó¤ÎÊó½·¤Ç%s", reward));
5735 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, format("The patron rewards you with %s.", reward));
5742 * XAngband: determine if a given location is "interesting"
5743 * based on target_set_accept function.
5745 static bool tgt_pt_accept(int y, int x)
5750 if (!(in_bounds(y, x))) return (FALSE);
5752 /* Player grid is always interesting */
5753 if ((y == py) && (x == px)) return (TRUE);
5755 /* Handle hallucination */
5756 if (p_ptr->image) return (FALSE);
5758 /* Examine the grid */
5759 c_ptr = &cave[y][x];
5761 /* Interesting memorized features */
5762 if (c_ptr->info & (CAVE_MARK))
5765 if (cave_have_flag_grid(c_ptr, FF_LESS)) return (TRUE);
5766 if (cave_have_flag_grid(c_ptr, FF_MORE)) return (TRUE);
5768 /* Notice quest features */
5769 if (cave_have_flag_grid(c_ptr, FF_QUEST_ENTER)) return (TRUE);
5770 if (cave_have_flag_grid(c_ptr, FF_QUEST_EXIT)) return (TRUE);
5779 * XAngband: Prepare the "temp" array for "tget_pt"
5780 * based on target_set_prepare funciton.
5782 static void tgt_pt_prepare(void)
5786 /* Reset "temp" array */
5789 if (!expand_list) return;
5791 /* Scan the current panel */
5792 for (y = 1; y < cur_hgt; y++)
5794 for (x = 1; x < cur_wid; x++)
5796 /* Require "interesting" contents */
5797 if (!tgt_pt_accept(y, x)) continue;
5799 /* Save the location */
5806 /* Target the nearest monster for shooting */
5807 ang_sort_comp = ang_sort_comp_distance;
5808 ang_sort_swap = ang_sort_swap_distance;
5810 /* Sort the positions */
5811 ang_sort(temp_x, temp_y, temp_n);
5815 * old -- from PsiAngband.
5817 bool tgt_pt(int *x_ptr, int *y_ptr)
5821 bool success = FALSE;
5826 get_screen_size(&wid, &hgt);
5838 msg_print("¾ì½ê¤òÁª¤ó¤Ç¥¹¥Ú¡¼¥¹¥¡¼¤ò²¡¤·¤Æ²¼¤µ¤¤¡£");
5840 msg_print("Select a point and press space.");
5842 msg_flag = FALSE; /* prevents "-more-" message. */
5844 while ((ch != ESCAPE) && !success)
5846 bool move_fast = FALSE;
5848 move_cursor_relative(y, x);
5860 if (player_bold(y, x)) ch = 0;
5863 else success = TRUE;
5867 /* XAngband: Move cursor to stairs */
5870 if (expand_list && temp_n)
5873 int cx = (panel_col_min + panel_col_max) / 2;
5874 int cy = (panel_row_min + panel_row_max) / 2;
5878 /* Skip stairs which have defferent distance */
5879 for (; n < temp_n; ++ n)
5881 cave_type *c_ptr = &cave[temp_y[n]][temp_x[n]];
5883 if (cave_have_flag_grid(c_ptr, FF_STAIRS) &&
5884 cave_have_flag_grid(c_ptr, ch == '>' ? FF_MORE : FF_LESS))
5891 if (n == temp_n) /* Loop out taget list */
5896 verify_panel(); /* Move cursor to player */
5899 p_ptr->update |= (PU_MONSTERS);
5902 p_ptr->redraw |= (PR_MAP);
5905 p_ptr->window |= (PW_OVERHEAD);
5910 else /* move cursor to next stair and change panel */
5915 dy = 2 * (y - cy) / hgt;
5916 dx = 2 * (x - cx) / wid;
5917 if (dy || dx) change_panel(dy, dx);
5923 /* Look up the direction */
5924 d = get_keymap_dir(ch);
5926 /* XTRA HACK MOVEFAST */
5927 if (isupper(ch)) move_fast = TRUE;
5929 /* Handle "direction" */
5935 /* XTRA HACK MOVEFAST */
5938 int mag = MIN(wid / 2, hgt / 2);
5948 /* Do not move horizontally if unnecessary */
5949 if (((x < panel_col_min + wid / 2) && (dx > 0)) ||
5950 ((x > panel_col_min + wid / 2) && (dx < 0)))
5955 /* Do not move vertically if unnecessary */
5956 if (((y < panel_row_min + hgt / 2) && (dy > 0)) ||
5957 ((y > panel_row_min + hgt / 2) && (dy < 0)))
5962 /* Apply the motion */
5963 if ((y >= panel_row_min + hgt) || (y < panel_row_min) ||
5964 (x >= panel_col_min + wid) || (x < panel_col_min))
5966 /* if (change_panel(dy, dx)) target_set_prepare(mode); */
5967 change_panel(dy, dx);
5970 /* Slide into legality */
5971 if (x >= cur_wid-1) x = cur_wid - 2;
5972 else if (x <= 0) x = 1;
5974 /* Slide into legality */
5975 if (y >= cur_hgt-1) y = cur_hgt- 2;
5976 else if (y <= 0) y = 1;
5983 /* Clear the top line */
5986 /* Recenter the map around the player */
5990 p_ptr->update |= (PU_MONSTERS);
5993 p_ptr->redraw |= (PR_MAP);
5996 p_ptr->window |= (PW_OVERHEAD);
6007 bool get_hack_dir(int *dp)
6017 /* Global direction */
6020 /* (No auto-targeting) */
6022 /* Ask until satisfied */
6025 /* Choose a prompt */
6029 p = "Êý¸þ ('*'¤Ç¥¿¡¼¥²¥Ã¥ÈÁªÂò, ESC¤ÇÃæÃÇ)? ";
6031 p = "Direction ('*' to choose a target, Escape to cancel)? ";
6038 p = "Êý¸þ ('5'¤Ç¥¿¡¼¥²¥Ã¥È¤Ø, '*'¤Ç¥¿¡¼¥²¥Ã¥ÈºÆÁªÂò, ESC¤ÇÃæÃÇ)? ";
6040 p = "Direction ('5' for target, '*' to re-target, Escape to cancel)? ";
6045 /* Get a command (or Cancel) */
6046 if (!get_com(p, &command, TRUE)) break;
6050 if (command == '\r') command = 't';
6053 /* Convert various keys to "standard" keys */
6056 /* Use current target */
6067 /* Set new target */
6072 if (target_set(TARGET_KILL)) dir = 5;
6078 /* Look up the direction */
6079 dir = get_keymap_dir(command);
6085 /* Verify requested targets */
6086 if ((dir == 5) && !target_okay()) dir = 0;
6093 if (!dir) return (FALSE);
6095 /* Save the direction */
6098 /* Check for confusion */
6099 if (p_ptr->confused)
6102 /* Random direction */
6103 dir = ddd[randint0(8)];
6106 /* Notice confusion */
6107 if (command_dir != dir)
6111 msg_print("¤¢¤Ê¤¿¤Ïº®Í𤷤Ƥ¤¤ë¡£");
6113 msg_print("You are confused.");
6118 /* Save direction */
6121 /* A "valid" direction was entered */
6127 * ¥¨¥Í¥ë¥®¡¼¤ÎÁý²ÃÎÌ10d5¤ò®¤¯·×»»¤¹¤ë¤¿¤á¤Î´Ø¿ô
6130 #define Go_no_JuuJou 5*5*5*5*5*5*5*5*5*5
6132 s16b gain_energy(void)
6135 s32b energy_result = 10;
6138 tmp = randint0(Go_no_JuuJou);
6140 for (i = 0; i < 9; i ++){
6141 energy_result += tmp % 5;
6145 return (s16b)(energy_result + tmp);
6152 s16b bow_energy(int sval)
6156 /* Analyze the launcher */
6159 /* Sling and ammo */
6166 /* Short Bow and Arrow */
6173 /* Long Bow and Arrow */
6180 /* Bow of irresponsiblity and Arrow */
6187 /* Light Crossbow and Bolt */
6194 /* Heavy Crossbow and Bolt */
6209 int bow_tmul(int sval)
6213 /* Analyze the launcher */
6216 /* Sling and ammo */
6223 /* Short Bow and Arrow */
6230 /* Long Bow and Arrow */
6237 /* Bow of irresponsiblity and Arrow */
6244 /* Light Crossbow and Bolt */
6251 /* Heavy Crossbow and Bolt */
6263 * Return alignment title
6265 cptr your_alignment(void)
6268 if (p_ptr->align > 150) return "ÂçÁ±";
6269 else if (p_ptr->align > 50) return "ÃæÁ±";
6270 else if (p_ptr->align > 10) return "¾®Á±";
6271 else if (p_ptr->align > -11) return "ÃæΩ";
6272 else if (p_ptr->align > -51) return "¾®°";
6273 else if (p_ptr->align > -151) return "Ãæ°";
6276 if (p_ptr->align > 150) return "Lawful";
6277 else if (p_ptr->align > 50) return "Good";
6278 else if (p_ptr->align > 10) return "Neutral Good";
6279 else if (p_ptr->align > -11) return "Neutral";
6280 else if (p_ptr->align > -51) return "Neutral Evil";
6281 else if (p_ptr->align > -151) return "Evil";
6282 else return "Chaotic";
6288 * Return proficiency level of weapons and misc. skills (except riding)
6290 int weapon_exp_level(int weapon_exp)
6292 if (weapon_exp < WEAPON_EXP_BEGINNER) return EXP_LEVEL_UNSKILLED;
6293 else if (weapon_exp < WEAPON_EXP_SKILLED) return EXP_LEVEL_BEGINNER;
6294 else if (weapon_exp < WEAPON_EXP_EXPERT) return EXP_LEVEL_SKILLED;
6295 else if (weapon_exp < WEAPON_EXP_MASTER) return EXP_LEVEL_EXPERT;
6296 else return EXP_LEVEL_MASTER;
6301 * Return proficiency level of riding
6303 int riding_exp_level(int riding_exp)
6305 if (riding_exp < RIDING_EXP_BEGINNER) return EXP_LEVEL_UNSKILLED;
6306 else if (riding_exp < RIDING_EXP_SKILLED) return EXP_LEVEL_BEGINNER;
6307 else if (riding_exp < RIDING_EXP_EXPERT) return EXP_LEVEL_SKILLED;
6308 else if (riding_exp < RIDING_EXP_MASTER) return EXP_LEVEL_EXPERT;
6309 else return EXP_LEVEL_MASTER;
6314 * Return proficiency level of spells
6316 int spell_exp_level(int spell_exp)
6318 if (spell_exp < SPELL_EXP_BEGINNER) return EXP_LEVEL_UNSKILLED;
6319 else if (spell_exp < SPELL_EXP_SKILLED) return EXP_LEVEL_BEGINNER;
6320 else if (spell_exp < SPELL_EXP_EXPERT) return EXP_LEVEL_SKILLED;
6321 else if (spell_exp < SPELL_EXP_MASTER) return EXP_LEVEL_EXPERT;
6322 else return EXP_LEVEL_MASTER;
6327 * Display a rumor and apply its effects
6330 int rumor_num(char *zz, int max_idx)
6332 if (strcmp(zz, "*") == 0) return randint1(max_idx - 1);
6336 cptr rumor_bind_name(char *base, cptr fullname)
6340 s = strstr(base, "{Name}");
6344 v = format("%s%s%s", base, fullname, (s + 6));
6354 void display_rumor(bool ex)
6362 if (randint0(3) == 0) section = 1;
6366 err = get_rnd_line_jonly("rumors_j.txt", section, Rumor, 10);
6367 if (err) strcpy(Rumor, "±³¤Î±½¤â¤¢¤ë¡£");
6369 err = get_rnd_line("rumors.txt", section, Rumor);
6370 if (err) strcpy(Rumor, "Some rumors are wrong.");
6375 if (strncmp(Rumor, "R:", 2) == 0)
6378 cptr rumor_msg = NULL;
6379 cptr rumor_eff_format = NULL;
6380 char fullname[1024] = "";
6382 if (tokenize(Rumor + 2, 3, zz, TOKENIZE_CHECKQUOTE) == 3)
6384 if (strcmp(zz[0], "ARTIFACT") == 0)
6388 object_type *q_ptr = &forge;
6389 artifact_type *a_ptr;
6393 a_idx = rumor_num(zz[1], max_a_idx);
6395 a_ptr = &a_info[a_idx];
6396 if (a_ptr->name) break;
6399 k_idx = lookup_kind(a_ptr->tval, a_ptr->sval);
6400 object_prep(q_ptr, k_idx);
6401 q_ptr->name1 = a_idx;
6402 q_ptr->ident = IDENT_STORE;
6403 object_desc(fullname, q_ptr, OD_NAME_ONLY);
6405 else if (strcmp(zz[0], "MONSTER") == 0)
6408 monster_race *r_ptr;
6412 r_idx = rumor_num(zz[1], max_r_idx);
6413 r_ptr = &r_info[r_idx];
6414 if (r_ptr->name) break;
6417 strcpy(fullname, r_name + r_ptr->name);
6419 /* Remember this monster */
6420 if (!r_ptr->r_sights)
6425 else if (strcmp(zz[0], "DUNGEON") == 0)
6428 dungeon_info_type *d_ptr;
6432 d_idx = rumor_num(zz[1], max_d_idx);
6433 d_ptr = &d_info[d_idx];
6434 if (d_ptr->name) break;
6437 strcpy(fullname, d_name + d_ptr->name);
6439 if (!max_dlv[d_idx])
6441 max_dlv[d_idx] = d_ptr->mindepth;
6442 rumor_eff_format = _("%s¤Ëµ¢´Ô¤Ç¤¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¡£", "You can recall to %s.");
6445 else if (strcmp(zz[0], "TOWN") == 0)
6452 t_idx = rumor_num(zz[1], NO_TOWN);
6453 if (town[t_idx].name) break;
6456 strcpy(fullname, town[t_idx].name);
6458 visit = (1L << (t_idx - 1));
6459 if ((t_idx != SECRET_TOWN) && !(p_ptr->visit & visit))
6461 p_ptr->visit |= visit;
6462 rumor_eff_format = _("%s¤Ë¹Ô¤Ã¤¿¤³¤È¤¬¤¢¤ëµ¤¤¬¤¹¤ë¡£", "You feel you have been to %s.");
6466 rumor_msg = rumor_bind_name(zz[2], fullname);
6467 msg_print(rumor_msg);
6468 if (rumor_eff_format)
6471 msg_format(rumor_eff_format, fullname);
6477 if (err) msg_print("¤³¤Î¾ðÊó¤Ï´Ö°ã¤Ã¤Æ¤¤¤ë¡£");
6479 if (err) msg_print("This information is wrong.");
6484 msg_format("%s", Rumor);