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)
432 int i, j, y, x, ny, nx;
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 */
452 for (i = max_quests - 1; i > 0; i--)
454 quest_type* const q_ptr = &quest[i];
456 /* Quest is not active */
457 if (q_ptr->status != QUEST_STATUS_TAKEN)
460 /* Quest is not a dungeon quest */
461 if (q_ptr->flags & QUEST_FLAG_PRESET)
464 /* Quest is not on this level */
465 if ((q_ptr->level != dun_level) &&
466 (q_ptr->type != QUEST_TYPE_KILL_ANY_LEVEL))
469 /* Not a "kill monster" quest */
470 if ((q_ptr->type == QUEST_TYPE_FIND_ARTIFACT) ||
471 (q_ptr->type == QUEST_TYPE_FIND_EXIT))
474 /* Interesting quest */
475 if ((q_ptr->type == QUEST_TYPE_KILL_NUMBER) ||
476 (q_ptr->type == QUEST_TYPE_TOWER) ||
477 (q_ptr->type == QUEST_TYPE_KILL_ALL))
480 /* Interesting quest */
481 if (((q_ptr->type == QUEST_TYPE_KILL_LEVEL) ||
482 (q_ptr->type == QUEST_TYPE_KILL_ANY_LEVEL) ||
483 (q_ptr->type == QUEST_TYPE_RANDOM)) &&
484 (q_ptr->r_idx == m_ptr->r_idx))
491 /* Handle the current quest */
492 if (quest_num && (quest[quest_num].status == QUEST_STATUS_TAKEN))
496 quest_type* const q_ptr = &quest[i];
500 case QUEST_TYPE_KILL_NUMBER:
504 if (q_ptr->cur_num >= q_ptr->num_mon)
512 case QUEST_TYPE_KILL_ALL:
514 if (!is_hostile(m_ptr)) break;
516 if (count_all_hostile_monsters() == 1)
518 if (q_ptr->flags & QUEST_FLAG_SILENT)
520 q_ptr->status = QUEST_STATUS_FINISHED;
529 case QUEST_TYPE_KILL_LEVEL:
530 case QUEST_TYPE_RANDOM:
532 /* Only count valid monsters */
533 if (q_ptr->r_idx != m_ptr->r_idx)
538 if (q_ptr->cur_num >= q_ptr->max_num)
542 if (!(q_ptr->flags & QUEST_FLAG_PRESET))
544 create_stairs = TRUE;
545 p_ptr->inside_quest = 0;
548 /* Finish the two main quests without rewarding */
549 if ((i == QUEST_OBERON) || (i == QUEST_SERPENT))
551 q_ptr->status = QUEST_STATUS_FINISHED;
554 if (q_ptr->type == QUEST_TYPE_RANDOM)
557 q_ptr->status = QUEST_STATUS_FINISHED;
562 case QUEST_TYPE_KILL_ANY_LEVEL:
565 if (q_ptr->cur_num >= q_ptr->max_num)
572 case QUEST_TYPE_TOWER:
574 if (!is_hostile(m_ptr)) break;
576 if (count_all_hostile_monsters() == 1)
578 q_ptr->status = QUEST_STATUS_STAGE_COMPLETED;
580 if((quest[QUEST_TOWER1].status == QUEST_STATUS_STAGE_COMPLETED) &&
581 (quest[QUEST_TOWER2].status == QUEST_STATUS_STAGE_COMPLETED) &&
582 (quest[QUEST_TOWER3].status == QUEST_STATUS_STAGE_COMPLETED))
585 complete_quest(QUEST_TOWER1);
593 /* Create a magical staircase */
597 while (cave_perma_bold(y, x) || cave[y][x].o_idx || (cave[y][x].info & CAVE_OBJECT) )
599 /* Pick a location */
600 scatter(&ny, &nx, y, x, 1, 0);
606 /* Explain the staircase */
608 msg_print("ËâË¡¤Î³¬Ãʤ¬¸½¤ì¤¿...");
610 msg_print("A magical staircase appears...");
614 /* Create stairs down */
615 cave_set_feat(y, x, feat_down_stair);
617 /* Remember to update everything */
618 p_ptr->update |= (PU_FLOW);
626 for (j = 0; j < (dun_level / 15)+1; j++)
628 /* Get local object */
631 /* Wipe the object */
634 /* Make a great object */
635 make_object(q_ptr, AM_GOOD | AM_GREAT);
637 /* Drop it in the dungeon */
638 (void)drop_near(q_ptr, -1, y, x);
644 void check_find_art_quest_completion(object_type *o_ptr)
647 /* Check if completed a quest */
648 for (i = 0; i < max_quests; i++)
650 if ((quest[i].type == QUEST_TYPE_FIND_ARTIFACT) &&
651 (quest[i].status == QUEST_STATUS_TAKEN) &&
652 (quest[i].k_idx == o_ptr->name1))
660 * Return monster death string
662 cptr extract_note_dies(monster_race *r_ptr)
664 /* Some monsters get "destroyed" */
665 if (!monster_living(r_ptr))
669 for (i = 0; i < 4; i++)
671 if (r_ptr->blow[i].method == RBM_EXPLODE)
674 return "¤ÏÇúȯ¤·¤ÆÊ´¡¹¤Ë¤Ê¤Ã¤¿¡£";
676 return " explodes into tiny shreds.";
684 return " is destroyed.";
688 /* Assume a default death */
698 * Handle the "death" of a monster.
700 * Disperse treasures centered at the monster location based on the
701 * various flags contained in the monster flags fields.
703 * Check for "Quest" completion when a quest monster is killed.
705 * Note that only the player can induce "monster_death()" on Uniques.
706 * Thus (for now) all Quest monsters should be Uniques.
708 * Note that monsters can now carry objects, and when a monster dies,
709 * it drops all of its objects, which may disappear in crowded rooms.
711 void monster_death(int m_idx, bool drop_item)
720 monster_type *m_ptr = &m_list[m_idx];
722 monster_race *r_ptr = &r_info[m_ptr->r_idx];
724 bool visible = ((m_ptr->ml && !p_ptr->image) || (r_ptr->flags1 & RF1_UNIQUE));
728 bool do_gold = (!(r_ptr->flags1 & RF1_ONLY_ITEM));
729 bool do_item = (!(r_ptr->flags1 & RF1_ONLY_GOLD));
730 bool cloned = (m_ptr->smart & SM_CLONED) ? TRUE : FALSE;
731 int force_coin = get_coin_type(m_ptr->r_idx);
736 bool drop_chosen_item = drop_item && !cloned && !p_ptr->inside_arena
737 && !p_ptr->inside_battle && !is_pet(m_ptr);
739 /* The caster is dead? */
740 if (world_monster && world_monster == m_idx) world_monster = 0;
742 /* Notice changes in view */
743 if (r_ptr->flags7 & (RF7_LITE_MASK | RF7_DARK_MASK))
745 /* Update some things */
746 p_ptr->update |= (PU_MON_LITE);
749 /* Get the location */
753 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
757 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
758 do_cmd_write_nikki(NIKKI_NAMED_PET, 3, m_name);
761 /* Let monsters explode! */
762 for (i = 0; i < 4; i++)
764 if (r_ptr->blow[i].method == RBM_EXPLODE)
766 int flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
767 int typ = mbe_info[r_ptr->blow[i].effect].explode_type;
768 int d_dice = r_ptr->blow[i].d_dice;
769 int d_side = r_ptr->blow[i].d_side;
770 int damage = damroll(d_dice, d_side);
772 project(m_idx, 3, y, x, damage, typ, flg, -1);
777 if (m_ptr->mflag2 & MFLAG2_CHAMELEON)
779 choose_new_monster(m_idx, TRUE, MON_CHAMELEON);
780 r_ptr = &r_info[m_ptr->r_idx];
783 /* Check for quest completion */
784 check_quest_completion(m_ptr);
786 /* Handle the possibility of player vanquishing arena combatant -KMW- */
787 if (p_ptr->inside_arena && !is_pet(m_ptr))
789 p_ptr->exit_bldg = TRUE;
791 if (p_ptr->arena_number > MAX_ARENA_MONS)
794 msg_print("ÁÇÀ²¤é¤·¤¤¡ª·¯¤³¤½¿¿¤Î¾¡Íø¼Ô¤À¡£");
796 msg_print("You are a Genuine Champion!");
802 msg_print("¾¡Íø¡ª¥Á¥ã¥ó¥Ô¥ª¥ó¤Ø¤ÎÆ»¤ò¿Ê¤ó¤Ç¤¤¤ë¡£");
804 msg_print("Victorious! You're on your way to becoming Champion.");
808 if (arena_info[p_ptr->arena_number].tval)
810 /* Get local object */
813 /* Prepare to make a prize */
814 object_prep(q_ptr, lookup_kind(arena_info[p_ptr->arena_number].tval, arena_info[p_ptr->arena_number].sval));
816 apply_magic(q_ptr, object_level, AM_NO_FIXED_ART);
818 /* Drop it in the dungeon */
819 (void)drop_near(q_ptr, -1, y, x);
822 if (p_ptr->arena_number > MAX_ARENA_MONS) p_ptr->arena_number++;
823 p_ptr->arena_number++;
828 /* Extract monster name */
829 monster_desc(m_name, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
831 do_cmd_write_nikki(NIKKI_ARENA, p_ptr->arena_number, m_name);
835 if (m_idx == p_ptr->riding)
837 if (rakuba(-1, FALSE))
840 msg_print("ÃÏÌ̤ËÍî¤È¤µ¤ì¤¿¡£");
842 msg_print("You have fallen from your riding pet.");
847 /* Drop a dead corpse? */
848 if (one_in_(r_ptr->flags1 & RF1_UNIQUE ? 1 : 4) &&
849 (r_ptr->flags9 & (RF9_DROP_CORPSE | RF9_DROP_SKELETON)) &&
850 !(p_ptr->inside_arena || p_ptr->inside_battle || cloned || ((m_ptr->r_idx == today_mon) && is_pet(m_ptr))))
852 /* Assume skeleton */
856 * We cannot drop a skeleton? Note, if we are in this check,
857 * we *know* we can drop at least a corpse or a skeleton
859 if (!(r_ptr->flags9 & RF9_DROP_SKELETON))
861 else if ((r_ptr->flags9 & RF9_DROP_CORPSE) && (r_ptr->flags1 & RF1_UNIQUE))
864 /* Else, a corpse is more likely unless we did a "lot" of damage */
865 else if (r_ptr->flags9 & RF9_DROP_CORPSE)
867 /* Lots of damage in one blow */
868 if ((0 - ((m_ptr->maxhp) / 4)) > m_ptr->hp)
870 if (one_in_(5)) corpse = TRUE;
874 if (!one_in_(5)) corpse = TRUE;
878 /* Get local object */
881 /* Prepare to make an object */
882 object_prep(q_ptr, lookup_kind(TV_CORPSE, (corpse ? SV_CORPSE : SV_SKELETON)));
884 apply_magic(q_ptr, object_level, AM_NO_FIXED_ART);
886 q_ptr->pval = m_ptr->r_idx;
888 /* Drop it in the dungeon */
889 (void)drop_near(q_ptr, -1, y, x);
892 /* Drop objects being carried */
893 monster_drop_carried_objects(m_ptr);
895 if (r_ptr->flags1 & RF1_DROP_GOOD) mo_mode |= AM_GOOD;
896 if (r_ptr->flags1 & RF1_DROP_GREAT) mo_mode |= AM_GREAT;
898 switch (m_ptr->r_idx)
900 case MON_PINK_HORROR:
901 /* Pink horrors are replaced with 2 Blue horrors */
902 if (!(p_ptr->inside_arena || p_ptr->inside_battle))
906 for (i = 0; i < 2; i++)
909 bool pet = is_pet(m_ptr);
912 if (pet) mode |= PM_FORCE_PET;
914 if (summon_specific((pet ? -1 : m_idx), wy, wx, 100, SUMMON_BLUE_HORROR, mode))
916 if (player_can_see_bold(wy, wx))
923 msg_print("¥Ô¥ó¥¯¡¦¥Û¥é¡¼¤ÏʬÎö¤·¤¿¡ª");
925 msg_print("The Pink horror divides!");
930 case MON_BLOODLETTER:
931 /* Bloodletters of Khorne may drop a blade of chaos */
932 if (drop_chosen_item && (randint1(100) < 15))
934 /* Get local object */
937 /* Prepare to make a Blade of Chaos */
938 object_prep(q_ptr, lookup_kind(TV_SWORD, SV_BLADE_OF_CHAOS));
940 apply_magic(q_ptr, object_level, AM_NO_FIXED_ART | mo_mode);
942 /* Drop it in the dungeon */
943 (void)drop_near(q_ptr, -1, y, x);
948 if (drop_chosen_item && (dun_level > 9))
950 /* Get local object */
953 /* Wipe the object */
956 /* Activate restriction */
957 if ((dun_level > 49) && one_in_(5))
958 get_obj_num_hook = kind_is_good_book;
960 get_obj_num_hook = kind_is_book;
963 make_object(q_ptr, mo_mode);
965 /* Drop it in the dungeon */
966 (void)drop_near(q_ptr, -1, y, x);
972 * Mega^3-hack: killing a 'Warrior of the Dawn' is likely to
973 * spawn another in the fallen one's place!
975 if (!p_ptr->inside_arena && !p_ptr->inside_battle)
981 bool pet = is_pet(m_ptr);
985 scatter(&wy, &wx, y, x, 20, 0);
987 while (!(in_bounds(wy, wx) && cave_empty_bold2(wy, wx)) && --attempts);
992 if (pet) mode |= PM_FORCE_PET;
994 if (summon_specific((pet ? -1 : m_idx), wy, wx, 100, SUMMON_DAWN, mode))
996 if (player_can_see_bold(wy, wx))
998 msg_print("¿·¤¿¤ÊÀï»Î¤¬¸½¤ì¤¿¡ª");
1000 msg_print("A new warrior steps forth!");
1010 /* One more ultra-hack: An Unmaker goes out with a big bang! */
1012 int flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
1013 (void)project(m_idx, 6, y, x, 100, GF_CHAOS, flg, -1);
1017 case MON_UNICORN_ORD:
1020 /* Reward for "lazy" player */
1021 if (p_ptr->pseikaku == SEIKAKU_NAMAKE)
1024 artifact_type *a_ptr = NULL;
1026 if (!drop_chosen_item) break;
1030 switch (randint0(3))
1033 a_idx = ART_NAMAKE_HAMMER;
1036 a_idx = ART_NAMAKE_BOW;
1039 a_idx = ART_NAMAKE_ARMOR;
1043 a_ptr = &a_info[a_idx];
1045 while (a_ptr->cur_num);
1047 /* Create the artifact */
1048 if (create_named_art(a_idx, y, x))
1052 /* Hack -- Memorize location of artifact in saved floors */
1053 if (character_dungeon) a_ptr->floor_id = p_ptr->floor_id;
1055 else if (!preserve_mode) a_ptr->cur_num = 1;
1060 if (!drop_chosen_item) break;
1062 /* Get local object */
1065 /* Mega-Hack -- Prepare to make "Grond" */
1066 object_prep(q_ptr, lookup_kind(TV_HAFTED, SV_GROND));
1068 /* Mega-Hack -- Mark this item as "Grond" */
1069 q_ptr->name1 = ART_GROND;
1071 /* Mega-Hack -- Actually create "Grond" */
1072 apply_magic(q_ptr, -1, AM_GOOD | AM_GREAT);
1074 /* Drop it in the dungeon */
1075 (void)drop_near(q_ptr, -1, y, x);
1077 /* Get local object */
1080 /* Mega-Hack -- Prepare to make "Chaos" */
1081 object_prep(q_ptr, lookup_kind(TV_CROWN, SV_CHAOS));
1083 /* Mega-Hack -- Mark this item as "Chaos" */
1084 q_ptr->name1 = ART_CHAOS;
1086 /* Mega-Hack -- Actually create "Chaos" */
1087 apply_magic(q_ptr, -1, AM_GOOD | AM_GREAT);
1089 /* Drop it in the dungeon */
1090 (void)drop_near(q_ptr, -1, y, x);
1093 case MON_B_DEATH_SWORD:
1094 if (drop_chosen_item)
1096 /* Get local object */
1099 /* Prepare to make a broken sword */
1100 object_prep(q_ptr, lookup_kind(TV_SWORD, randint1(2)));
1102 /* Drop it in the dungeon */
1103 (void)drop_near(q_ptr, -1, y, x);
1109 if (drop_chosen_item && ((m_ptr->r_idx == MON_A_GOLD) ||
1110 ((m_ptr->r_idx == MON_A_SILVER) && (r_ptr->r_akills % 5 == 0))))
1112 /* Get local object */
1115 /* Prepare to make a Can of Toys */
1116 object_prep(q_ptr, lookup_kind(TV_CHEST, SV_CHEST_KANDUME));
1118 apply_magic(q_ptr, object_level, AM_NO_FIXED_ART);
1120 /* Drop it in the dungeon */
1121 (void)drop_near(q_ptr, -1, y, x);
1127 int flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
1128 (void)project(m_idx, 3, y, x, damroll(20, 10), GF_FIRE, flg, -1);
1133 if (!drop_chosen_item) break;
1135 switch (r_ptr->d_char)
1140 /* Get local object */
1143 /* Wipe the object */
1146 /* Activate restriction */
1147 get_obj_num_hook = kind_is_cloak;
1150 make_object(q_ptr, mo_mode);
1152 /* Drop it in the dungeon */
1153 (void)drop_near(q_ptr, -1, y, x);
1160 /* Get local object */
1163 /* Wipe the object */
1166 /* Activate restriction */
1167 get_obj_num_hook = kind_is_polearm;
1169 /* Make a poleweapon */
1170 make_object(q_ptr, mo_mode);
1172 /* Drop it in the dungeon */
1173 (void)drop_near(q_ptr, -1, y, x);
1180 /* Get local object */
1183 /* Wipe the object */
1186 /* Activate restriction */
1187 get_obj_num_hook = kind_is_armor;
1189 /* Make a hard armor */
1190 make_object(q_ptr, mo_mode);
1192 /* Drop it in the dungeon */
1193 (void)drop_near(q_ptr, -1, y, x);
1200 /* Get local object */
1203 /* Wipe the object */
1206 /* Activate restriction */
1207 get_obj_num_hook = kind_is_hafted;
1209 /* Make a hafted weapon */
1210 make_object(q_ptr, mo_mode);
1212 /* Drop it in the dungeon */
1213 (void)drop_near(q_ptr, -1, y, x);
1218 if (m_ptr->r_idx != MON_STORMBRINGER)
1220 /* Get local object */
1223 /* Wipe the object */
1226 /* Activate restriction */
1227 get_obj_num_hook = kind_is_sword;
1230 make_object(q_ptr, mo_mode);
1232 /* Drop it in the dungeon */
1233 (void)drop_near(q_ptr, -1, y, x);
1240 /* Mega-Hack -- drop fixed items */
1241 if (drop_chosen_item)
1246 switch (m_ptr->r_idx)
1266 case MON_STORMBRINGER:
1267 a_idx = ART_STORMBRINGER;
1272 a_idx = ART_CRIMSON;
1282 a_idx = ART_KUSANAGI;
1312 a_idx = ART_WEREWINDLE;
1320 a_idx = ART_GRAYSWANDIR;
1331 a_idx = ART_TWILIGHT;
1336 a_idx = ART_ELENDIL;
1351 a_idx = ART_DESTINY;
1356 a_idx = ART_ZANTETSU;
1371 a_idx = ART_WINBLOWS;
1375 case MON_LUNGORTHIN:
1380 case MON_JACK_SHADOWS:
1386 a_idx = ART_STONEMASK;
1391 a_idx = ART_SOULCRUSH;
1396 a_idx = ART_EXCALIBUR_J;
1401 a_idx = ART_SHUTEN_DOJI;
1406 a_idx = ART_GOTHMOG;
1415 case MON_ROBIN_HOOD:
1416 a_idx = ART_ROBIN_HOOD;
1421 if ((a_idx > 0) && ((randint0(100) < chance) || p_ptr->wizard))
1423 artifact_type *a_ptr = &a_info[a_idx];
1425 if (!a_ptr->cur_num)
1427 /* Create the artifact */
1428 if (create_named_art(a_idx, y, x))
1432 /* Hack -- Memorize location of artifact in saved floors */
1433 if (character_dungeon) a_ptr->floor_id = p_ptr->floor_id;
1435 else if (!preserve_mode) a_ptr->cur_num = 1;
1439 if ((r_ptr->flags7 & RF7_GUARDIAN) && (d_info[dungeon_type].final_guardian == m_ptr->r_idx))
1441 int k_idx = d_info[dungeon_type].final_object ? d_info[dungeon_type].final_object
1442 : lookup_kind(TV_SCROLL, SV_SCROLL_ACQUIREMENT);
1444 if (d_info[dungeon_type].final_artifact)
1446 int a_idx = d_info[dungeon_type].final_artifact;
1447 artifact_type *a_ptr = &a_info[a_idx];
1449 if (!a_ptr->cur_num)
1451 /* Create the artifact */
1452 if (create_named_art(a_idx, y, x))
1456 /* Hack -- Memorize location of artifact in saved floors */
1457 if (character_dungeon) a_ptr->floor_id = p_ptr->floor_id;
1459 else if (!preserve_mode) a_ptr->cur_num = 1;
1461 /* Prevent rewarding both artifact and "default" object */
1462 if (!d_info[dungeon_type].final_object) k_idx = 0;
1468 /* Get local object */
1471 /* Prepare to make a reward */
1472 object_prep(q_ptr, k_idx);
1474 apply_magic(q_ptr, object_level, AM_NO_FIXED_ART | AM_GOOD);
1476 /* Drop it in the dungeon */
1477 (void)drop_near(q_ptr, -1, y, x);
1480 msg_format("¤¢¤Ê¤¿¤Ï%s¤òÀ©ÇƤ·¤¿¡ª",d_name+d_info[dungeon_type].name);
1482 msg_format("You have conquered %s!",d_name+d_info[dungeon_type].name);
1487 /* Determine how much we can drop */
1488 if ((r_ptr->flags1 & RF1_DROP_60) && (randint0(100) < 60)) number++;
1489 if ((r_ptr->flags1 & RF1_DROP_90) && (randint0(100) < 90)) number++;
1490 if (r_ptr->flags1 & RF1_DROP_1D2) number += damroll(1, 2);
1491 if (r_ptr->flags1 & RF1_DROP_2D2) number += damroll(2, 2);
1492 if (r_ptr->flags1 & RF1_DROP_3D2) number += damroll(3, 2);
1493 if (r_ptr->flags1 & RF1_DROP_4D2) number += damroll(4, 2);
1495 if (cloned && !(r_ptr->flags1 & RF1_UNIQUE))
1496 number = 0; /* Clones drop no stuff unless Cloning Pits */
1498 if (is_pet(m_ptr) || p_ptr->inside_battle || p_ptr->inside_arena)
1499 number = 0; /* Pets drop no stuff */
1500 if (!drop_item && (r_ptr->d_char != '$')) number = 0;
1502 if((r_ptr->flags2 & (RF2_MULTIPLY)) && (r_ptr->r_akills > 1024))
1503 number = 0; /* Limit of Multiply monster drop */
1505 /* Hack -- handle creeping coins */
1506 coin_type = force_coin;
1508 /* Average dungeon and monster levels */
1509 object_level = (dun_level + r_ptr->level) / 2;
1511 /* Drop some objects */
1512 for (j = 0; j < number; j++)
1514 /* Get local object */
1517 /* Wipe the object */
1521 if (do_gold && (!do_item || (randint0(100) < 50)))
1523 /* Make some gold */
1524 if (!make_gold(q_ptr)) continue;
1533 /* Make an object */
1534 if (!make_object(q_ptr, mo_mode)) continue;
1540 /* Drop it in the dungeon */
1541 (void)drop_near(q_ptr, -1, y, x);
1544 /* Reset the object level */
1545 object_level = base_level;
1547 /* Reset "coin" type */
1551 /* Take note of any dropped treasure */
1552 if (visible && (dump_item || dump_gold))
1554 /* Take notes on treasure */
1555 lore_treasure(m_idx, dump_item, dump_gold);
1558 /* Only process "Quest Monsters" */
1559 if (!(r_ptr->flags1 & RF1_QUESTOR)) return;
1560 if (p_ptr->inside_battle) return;
1563 if ((m_ptr->r_idx == MON_SERPENT) && !cloned)
1566 p_ptr->total_winner = TRUE;
1568 /* Redraw the "title" */
1569 p_ptr->redraw |= (PR_TITLE);
1572 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "¸«»ö¤ËÊѶòÈÚÅܤξ¡Íø¼Ô¤È¤Ê¤Ã¤¿¡ª");
1574 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "become *WINNER* of Hengband finely!");
1577 if ((p_ptr->pclass == CLASS_CHAOS_WARRIOR) || (p_ptr->muta2 & MUT2_CHAOS_GIFT))
1580 msg_format("%s¤«¤é¤ÎÀ¼¤¬¶Á¤¤¤¿¡£", chaos_patrons[p_ptr->chaos_patron]);
1581 msg_print("¡Ø¤è¤¯¤ä¤Ã¤¿¡¢ÄêÌ¿¤Î¼Ô¤è¡ª¡Ù");
1583 msg_format("The voice of %s booms out:", chaos_patrons[p_ptr->chaos_patron]);
1584 msg_print("'Thou art donst well, mortal!'");
1588 /* Congratulations */
1590 msg_print("*** ¤ª¤á¤Ç¤È¤¦ ***");
1592 msg_print("*** CONGRATULATIONS ***");
1596 msg_print("¤¢¤Ê¤¿¤Ï¥²¡¼¥à¤ò¥³¥ó¥×¥ê¡¼¥È¤·¤Þ¤·¤¿¡£");
1598 msg_print("You have won the game!");
1602 msg_print("½àÈ÷¤¬À°¤Ã¤¿¤é°úÂà(¼«»¦¥³¥Þ¥ó¥É)¤·¤Æ¤â·ë¹½¤Ç¤¹¡£");
1604 msg_print("You may retire (commit suicide) when you are ready.");
1610 * Modify the physical damage done to the monster.
1611 * (for example when it's invulnerable or shielded)
1613 * ToDo: Accept a damage-type to calculate the modified damage from
1614 * things like fire, frost, lightning, poison, ... attacks.
1616 * "type" is not yet used and should be 0.
1618 int mon_damage_mod(monster_type *m_ptr, int dam, bool is_psy_spear)
1620 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1622 if ((r_ptr->flagsr & RFR_RES_ALL) && dam > 0)
1625 if ((dam == 0) && one_in_(3)) dam = 1;
1628 if (MON_INVULNER(m_ptr))
1632 if (!p_ptr->blind && is_seen(m_ptr))
1635 msg_print("¥Ð¥ê¥¢¤òÀÚ¤êÎö¤¤¤¿¡ª");
1637 msg_print("The barrier is penetrated!");
1641 else if (!one_in_(PENETRATE_INVULNERABILITY))
1651 * Calculate experience point to be get
1653 * Even the 64 bit operation is not big enough to avoid overflaw
1654 * unless we carefully choose orders of multiplication and division.
1656 * Get the coefficient first, and multiply (potentially huge) base
1657 * experience point of a monster later.
1659 static void get_exp_from_mon(int dam, monster_type *m_ptr)
1661 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1668 if (!m_ptr->r_idx) return;
1669 if (is_pet(m_ptr) || p_ptr->inside_battle) return;
1672 * - Ratio of monster's level to player's level effects
1673 * - Varying speed effects
1674 * - Get a fraction in proportion of damage point
1676 new_exp = r_ptr->level * SPEED_TO_ENERGY(m_ptr->mspeed) * dam;
1679 div_l = (p_ptr->max_plv+2) * SPEED_TO_ENERGY(r_ptr->speed);
1681 /* Use (average maxhp * 2) as a denominator */
1682 if (!(r_ptr->flags1 & RF1_FORCE_MAXHP))
1683 s64b_mul(&div_h, &div_l, 0, r_ptr->hdice * (ironman_nightmare ? 2 : 1) * (r_ptr->hside + 1));
1685 s64b_mul(&div_h, &div_l, 0, r_ptr->hdice * (ironman_nightmare ? 2 : 1) * r_ptr->hside * 2);
1687 /* Special penalty in the wilderness */
1688 if (!dun_level && (!(r_ptr->flags8 & RF8_WILD_ONLY) || !(r_ptr->flags1 & RF1_UNIQUE)))
1689 s64b_mul(&div_h, &div_l, 0, 5);
1691 /* Do division first to prevent overflaw */
1692 s64b_div(&new_exp, &new_exp_frac, div_h, div_l);
1694 /* Special penalty for mutiply-monster */
1695 if ((r_ptr->flags2 & RF2_MULTIPLY) || (m_ptr->r_idx == MON_DAWN))
1697 int monnum_penarty = r_ptr->r_akills / 400;
1698 if (monnum_penarty > 8) monnum_penarty = 8;
1700 while (monnum_penarty--)
1703 s64b_RSHIFT(new_exp, new_exp_frac, 2);
1707 /* Special penalty for rest_and_shoot exp scum */
1708 if ((m_ptr->dealt_damage > m_ptr->max_maxhp) && (m_ptr->hp >= 0))
1710 int over_damage = m_ptr->dealt_damage / m_ptr->max_maxhp;
1711 if (over_damage > 32) over_damage = 32;
1713 while (over_damage--)
1716 s64b_mul(&new_exp, &new_exp_frac, 0, 9);
1717 s64b_div(&new_exp, &new_exp_frac, 0, 10);
1721 /* Finally multiply base experience point of the monster */
1722 s64b_mul(&new_exp, &new_exp_frac, 0, r_ptr->mexp);
1724 /* Gain experience */
1725 gain_exp_64(new_exp, new_exp_frac);
1730 * Decreases monsters hit points, handling monster death.
1732 * We return TRUE if the monster has been killed (and deleted).
1734 * We announce monster death (using an optional "death message"
1735 * if given, and a otherwise a generic killed/destroyed message).
1737 * Only "physical attacks" can induce the "You have slain" message.
1738 * Missile and Spell attacks will induce the "dies" message, or
1739 * various "specialized" messages. Note that "You have destroyed"
1740 * and "is destroyed" are synonyms for "You have slain" and "dies".
1742 * Hack -- unseen monsters yield "You have killed it." message.
1744 * Added fear (DGK) and check whether to print fear messages -CWS
1746 * Made name, sex, and capitalization generic -BEN-
1748 * As always, the "ghost" processing is a total hack.
1750 * Hack -- we "delay" fear messages by passing around a "fear" flag.
1752 * XXX XXX XXX Consider decreasing monster experience over time, say,
1753 * by using "(m_exp * m_lev * (m_lev)) / (p_lev * (m_lev + n_killed))"
1754 * instead of simply "(m_exp * m_lev) / (p_lev)", to make the first
1755 * monster worth more than subsequent monsters. This would also need
1756 * to induce changes in the monster recall code.
1758 bool mon_take_hit(int m_idx, int dam, bool *fear, cptr note)
1760 monster_type *m_ptr = &m_list[m_idx];
1761 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1763 monster_type exp_mon;
1765 /* Innocent until proven otherwise */
1766 bool innocent = TRUE, thief = FALSE;
1771 (void)COPY(&exp_mon, m_ptr, monster_type);
1773 expdam = (m_ptr->hp > dam) ? dam : m_ptr->hp;
1775 get_exp_from_mon(expdam, &exp_mon);
1777 /* Genocided by chaos patron */
1778 if (!m_ptr->r_idx) m_idx = 0;
1780 /* Redraw (later) if needed */
1781 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1782 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
1785 (void)set_monster_csleep(m_idx, 0);
1787 /* Hack - Cancel any special player stealth magics. -LM- */
1788 if (p_ptr->special_defense & NINJA_S_STEALTH)
1790 set_superstealth(FALSE);
1793 /* Genocided by chaos patron */
1794 if (!m_idx) return TRUE;
1796 /* Remember dealt_damage before this attack*/
1797 dealt_damage = m_ptr->dealt_damage;
1802 m_ptr->dealt_damage += dam;
1803 if(m_ptr->dealt_damage > m_ptr->max_maxhp * 100) m_ptr->dealt_damage = m_ptr->max_maxhp * 100;
1806 msg_format( _("¹ç·×%d/%d¤Î¥À¥á¡¼¥¸¤òÍ¿¤¨¤¿¡£","You do %d (out of %d) damage."),
1807 m_ptr->dealt_damage, m_ptr->maxhp);
1810 /* It is dead now */
1815 if (r_info[m_ptr->r_idx].flags7 & RF7_TANUKI)
1817 /* You might have unmasked Tanuki first time */
1818 r_ptr = &r_info[m_ptr->r_idx];
1819 m_ptr->ap_r_idx = m_ptr->r_idx;
1820 if (r_ptr->r_sights < MAX_SHORT) r_ptr->r_sights++;
1823 if (m_ptr->mflag2 & MFLAG2_CHAMELEON)
1825 /* You might have unmasked Chameleon first time */
1826 r_ptr = real_r_ptr(m_ptr);
1827 if (r_ptr->r_sights < MAX_SHORT) r_ptr->r_sights++;
1830 if (!(m_ptr->smart & SM_CLONED))
1832 /* When the player kills a Unique, it stays dead */
1833 if (r_ptr->flags1 & RF1_UNIQUE)
1837 /* Mega-Hack -- Banor & Lupart */
1838 if ((m_ptr->r_idx == MON_BANOR) || (m_ptr->r_idx == MON_LUPART))
1840 r_info[MON_BANORLUPART].max_num = 0;
1841 r_info[MON_BANORLUPART].r_pkills++;
1842 r_info[MON_BANORLUPART].r_akills++;
1843 if (r_info[MON_BANORLUPART].r_tkills < MAX_SHORT) r_info[MON_BANORLUPART].r_tkills++;
1845 else if (m_ptr->r_idx == MON_BANORLUPART)
1847 r_info[MON_BANOR].max_num = 0;
1848 r_info[MON_BANOR].r_pkills++;
1849 r_info[MON_BANOR].r_akills++;
1850 if (r_info[MON_BANOR].r_tkills < MAX_SHORT) r_info[MON_BANOR].r_tkills++;
1851 r_info[MON_LUPART].max_num = 0;
1852 r_info[MON_LUPART].r_pkills++;
1853 r_info[MON_LUPART].r_akills++;
1854 if (r_info[MON_LUPART].r_tkills < MAX_SHORT) r_info[MON_LUPART].r_tkills++;
1858 /* When the player kills a Nazgul, it stays dead */
1859 else if (r_ptr->flags7 & RF7_NAZGUL) r_ptr->max_num--;
1862 /* Count all monsters killed */
1863 if (r_ptr->r_akills < MAX_SHORT) r_ptr->r_akills++;
1865 /* Recall even invisible uniques or winners */
1866 if ((m_ptr->ml && !p_ptr->image) || (r_ptr->flags1 & RF1_UNIQUE))
1868 /* Count kills this life */
1869 if ((m_ptr->mflag2 & MFLAG2_KAGE) && (r_info[MON_KAGE].r_pkills < MAX_SHORT)) r_info[MON_KAGE].r_pkills++;
1870 else if (r_ptr->r_pkills < MAX_SHORT) r_ptr->r_pkills++;
1872 /* Count kills in all lives */
1873 if ((m_ptr->mflag2 & MFLAG2_KAGE) && (r_info[MON_KAGE].r_tkills < MAX_SHORT)) r_info[MON_KAGE].r_tkills++;
1874 else if (r_ptr->r_tkills < MAX_SHORT) r_ptr->r_tkills++;
1876 /* Hack -- Auto-recall */
1877 monster_race_track(m_ptr->ap_r_idx);
1880 /* Extract monster name */
1881 monster_desc(m_name, m_ptr, MD_TRUE_NAME);
1883 /* Don't kill Amberites */
1884 if ((r_ptr->flags3 & RF3_AMBERITE) && one_in_(2))
1886 int curses = 1 + randint1(3);
1887 bool stop_ty = FALSE;
1891 msg_format("%^s¤Ï¶²¤í¤·¤¤·ì¤Î¼ö¤¤¤ò¤¢¤Ê¤¿¤Ë¤«¤±¤¿¡ª", m_name);
1893 msg_format("%^s puts a terrible blood curse on you!", m_name);
1896 curse_equipment(100, 50);
1900 stop_ty = activate_ty_curse(stop_ty, &count);
1905 if (r_ptr->flags2 & RF2_CAN_SPEAK)
1907 char line_got[1024];
1909 /* Dump a message */
1911 if (!get_rnd_line("mondeath_j.txt", m_ptr->r_idx, line_got))
1913 if (!get_rnd_line("mondeath.txt", m_ptr->r_idx, line_got))
1916 msg_format("%^s %s", m_name, line_got);
1919 if (m_ptr->r_idx == MON_SERPENT)
1921 /* Make screen dump */
1922 screen_dump = make_screen_dump();
1927 if (!(d_info[dungeon_type].flags1 & DF1_BEGINNER))
1929 if (!dun_level && !ambush_flag && !p_ptr->inside_arena)
1931 chg_virtue(V_VALOUR, -1);
1933 else if (r_ptr->level > dun_level)
1935 if (randint1(10) <= (r_ptr->level - dun_level))
1936 chg_virtue(V_VALOUR, 1);
1938 if (r_ptr->level > 60)
1940 chg_virtue(V_VALOUR, 1);
1942 if (r_ptr->level >= 2 * (p_ptr->lev+1))
1943 chg_virtue(V_VALOUR, 2);
1946 if (r_ptr->flags1 & RF1_UNIQUE)
1948 if (r_ptr->flags3 & (RF3_EVIL | RF3_GOOD)) chg_virtue(V_HARMONY, 2);
1950 if (r_ptr->flags3 & RF3_GOOD)
1952 chg_virtue(V_UNLIFE, 2);
1953 chg_virtue(V_VITALITY, -2);
1956 if (one_in_(3)) chg_virtue(V_INDIVIDUALISM, -1);
1959 if (m_ptr->r_idx == MON_BEGGAR || m_ptr->r_idx == MON_LEPER)
1961 chg_virtue(V_COMPASSION, -1);
1964 if ((r_ptr->flags3 & RF3_GOOD) &&
1965 ((r_ptr->level) / 10 + (3 * dun_level) >= randint1(100)))
1966 chg_virtue(V_UNLIFE, 1);
1968 if (r_ptr->d_char == 'A')
1970 if (r_ptr->flags1 & RF1_UNIQUE)
1971 chg_virtue(V_FAITH, -2);
1972 else if ((r_ptr->level) / 10 + (3 * dun_level) >= randint1(100))
1974 if (r_ptr->flags3 & RF3_GOOD) chg_virtue(V_FAITH, -1);
1975 else chg_virtue(V_FAITH, 1);
1978 else if (r_ptr->flags3 & RF3_DEMON)
1980 if (r_ptr->flags1 & RF1_UNIQUE)
1981 chg_virtue(V_FAITH, 2);
1982 else if ((r_ptr->level) / 10 + (3 * dun_level) >= randint1(100))
1983 chg_virtue(V_FAITH, 1);
1986 if ((r_ptr->flags3 & RF3_UNDEAD) && (r_ptr->flags1 & RF1_UNIQUE))
1987 chg_virtue(V_VITALITY, 2);
1989 if (r_ptr->r_deaths)
1991 if (r_ptr->flags1 & RF1_UNIQUE)
1993 chg_virtue(V_HONOUR, 10);
1995 else if ((r_ptr->level) / 10 + (2 * dun_level) >= randint1(100))
1997 chg_virtue(V_HONOUR, 1);
2000 if ((r_ptr->flags2 & RF2_MULTIPLY) && (r_ptr->r_akills > 1000) && one_in_(10))
2002 chg_virtue(V_VALOUR, -1);
2005 for (i = 0; i < 4; i++)
2007 if (r_ptr->blow[i].d_dice != 0) innocent = FALSE; /* Murderer! */
2009 if ((r_ptr->blow[i].effect == RBE_EAT_ITEM)
2010 || (r_ptr->blow[i].effect == RBE_EAT_GOLD))
2012 thief = TRUE; /* Thief! */
2015 /* The new law says it is illegal to live in the dungeon */
2016 if (r_ptr->level != 0) innocent = FALSE;
2020 if (r_ptr->flags1 & RF1_UNIQUE)
2021 chg_virtue(V_JUSTICE, 3);
2022 else if (1+((r_ptr->level) / 10 + (2 * dun_level))
2024 chg_virtue(V_JUSTICE, 1);
2028 chg_virtue (V_JUSTICE, -1);
2031 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)))
2033 if (one_in_(4)) chg_virtue(V_NATURE, -1);
2036 if ((r_ptr->flags1 & RF1_UNIQUE) && record_destroy_uniq)
2040 sprintf(note_buf, "%s%s", r_name + r_ptr->name, (m_ptr->smart & SM_CLONED) ? "(¥¯¥í¡¼¥ó)" : "");
2042 sprintf(note_buf, "%s%s", r_name + r_ptr->name, (m_ptr->smart & SM_CLONED) ? "(Clone)" : "");
2044 do_cmd_write_nikki(NIKKI_UNIQUE, 0, note_buf);
2050 /* Death by Missile/Spell attack */
2053 msg_format("%^s%s", m_name, note);
2056 /* Death by physical attack -- invisible monster */
2057 else if (!m_ptr->ml)
2060 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
2061 msg_format("¤»¤Ã¤«¤¯¤À¤«¤é%s¤ò»¦¤·¤¿¡£", m_name);
2063 msg_format("%s¤ò»¦¤·¤¿¡£", m_name);
2065 msg_format("You have killed %s.", m_name);
2070 /* Death by Physical attack -- non-living monster */
2071 else if (!monster_living(r_ptr))
2074 bool explode = FALSE;
2076 for (i = 0; i < 4; i++)
2078 if (r_ptr->blow[i].method == RBM_EXPLODE) explode = TRUE;
2081 /* Special note at death */
2084 msg_format("%s¤ÏÇúȯ¤·¤ÆÊ´¡¹¤Ë¤Ê¤Ã¤¿¡£", m_name);
2086 msg_format("%^s explodes into tiny shreds.", m_name);
2091 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
2092 msg_format("¤»¤Ã¤«¤¯¤À¤«¤é%s¤òÅݤ·¤¿¡£", m_name);
2094 msg_format("%s¤òÅݤ·¤¿¡£", m_name);
2096 msg_format("You have destroyed %s.", m_name);
2101 /* Death by Physical attack -- living monster */
2105 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
2106 msg_format("¤»¤Ã¤«¤¯¤À¤«¤é%s¤òÁò¤êµî¤Ã¤¿¡£", m_name);
2108 msg_format("%s¤òÁò¤êµî¤Ã¤¿¡£", m_name);
2110 msg_format("You have slain %s.", m_name);
2114 if ((r_ptr->flags1 & RF1_UNIQUE) && !(m_ptr->smart & SM_CLONED) && !vanilla_town)
2116 for (i = 0; i < MAX_KUBI; i++)
2118 if ((kubi_r_idx[i] == m_ptr->r_idx) && !(m_ptr->mflag2 & MFLAG2_CHAMELEON))
2121 msg_format("%s¤Î¼ó¤Ë¤Ï¾Þ¶â¤¬¤«¤«¤Ã¤Æ¤¤¤ë¡£", m_name);
2123 msg_format("There is a price on %s's head.", m_name);
2130 /* Generate treasure */
2131 monster_death(m_idx, TRUE);
2133 /* Mega hack : replace IKETA to BIKETAL */
2134 if ((m_ptr->r_idx == MON_IKETA) &&
2135 !(p_ptr->inside_arena || p_ptr->inside_battle))
2137 int dummy_y = m_ptr->fy;
2138 int dummy_x = m_ptr->fx;
2141 if (is_pet(m_ptr)) mode |= PM_FORCE_PET;
2143 /* Delete the monster */
2144 delete_monster_idx(m_idx);
2146 if (summon_named_creature(0, dummy_y, dummy_x, MON_BIKETAL, mode))
2149 msg_print("¡Ö¥Ï¥¡¥Ã¥Ï¥Ã¥Ï¥Ã¥Ï¡ª¡ª»ä¤¬¥Ð¥¤¥±¥¿¥ë¤À¡ª¡ª¡×");
2151 msg_print("Uwa-hahaha! *I* am Biketal!");
2157 /* Delete the monster */
2158 delete_monster_idx(m_idx);
2161 get_exp_from_mon((long)exp_mon.max_maxhp*2, &exp_mon);
2166 /* Monster is dead */
2173 /* Mega-Hack -- Pain cancels fear */
2174 if (MON_MONFEAR(m_ptr) && (dam > 0))
2177 if (set_monster_monfear(m_idx, MON_MONFEAR(m_ptr) - randint1(dam)))
2184 /* Sometimes a monster gets scared by damage */
2185 if (!MON_MONFEAR(m_ptr) && !(r_ptr->flags3 & (RF3_NO_FEAR)))
2187 /* Percentage of fully healthy */
2188 int percentage = (100L * m_ptr->hp) / m_ptr->maxhp;
2191 * Run (sometimes) if at 10% or less of max hit points,
2192 * or (usually) when hit for half its current hit points
2194 if ((randint1(10) >= percentage) ||
2195 ((dam >= m_ptr->hp) && (randint0(100) < 80)))
2197 /* Hack -- note fear */
2200 /* XXX XXX XXX Hack -- Add some timed fear */
2201 (void)set_monster_monfear(m_idx, (randint1(10) +
2202 (((dam >= m_ptr->hp) && (percentage > 7)) ?
2203 20 : ((11 - percentage) * 5))));
2210 if (p_ptr->riding && (p_ptr->riding == m_idx) && (dam > 0))
2214 /* Extract monster name */
2215 monster_desc(m_name, m_ptr, 0);
2217 if (m_ptr->hp > m_ptr->maxhp/3) dam = (dam + 1) / 2;
2218 if (rakuba((dam > 200) ? 200 : dam, FALSE))
2221 msg_format("%^s¤Ë¿¶¤êÍî¤È¤µ¤ì¤¿¡ª", m_name);
2223 msg_format("%^s has thrown you off!", m_name);
2235 * Get term size and calculate screen size
2237 void get_screen_size(int *wid_p, int *hgt_p)
2239 Term_get_size(wid_p, hgt_p);
2240 *hgt_p -= ROW_MAP + 2;
2241 *wid_p -= COL_MAP + 2;
2242 if (use_bigtile) *wid_p /= 2;
2247 * Calculates current boundaries
2248 * Called below and from "do_cmd_locate()".
2250 void panel_bounds_center(void)
2255 get_screen_size(&wid, &hgt);
2257 panel_row_max = panel_row_min + hgt - 1;
2258 panel_row_prt = panel_row_min - 1;
2259 panel_col_max = panel_col_min + wid - 1;
2260 panel_col_prt = panel_col_min - 13;
2265 * Map resizing whenever the main term changes size
2267 void resize_map(void)
2269 /* Only if the dungeon exists */
2270 if (!character_dungeon) return;
2272 /* Mega-Hack -- no panel yet */
2276 /* Reset the panels */
2277 panel_row_min = cur_hgt;
2278 panel_col_min = cur_wid;
2283 p_ptr->update |= (PU_TORCH | PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
2285 /* Forget lite/view */
2286 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
2288 /* Update lite/view */
2289 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
2291 /* Update monsters */
2292 p_ptr->update |= (PU_MONSTERS);
2294 /* Redraw everything */
2295 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
2297 /* Hack -- update */
2305 * Place the cursor on the player
2307 if (can_save) move_cursor_relative(py, px);
2314 * Redraw a term when it is resized
2316 void redraw_window(void)
2318 /* Only if the dungeon exists */
2319 if (!character_dungeon) return;
2322 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
2325 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
2327 /* Hack -- update */
2336 * Handle a request to change the current panel
2338 * Return TRUE if the panel was changed.
2340 * Also used in do_cmd_locate
2342 bool change_panel(int dy, int dx)
2348 get_screen_size(&wid, &hgt);
2350 /* Apply the motion */
2351 y = panel_row_min + dy * hgt / 2;
2352 x = panel_col_min + dx * wid / 2;
2354 /* Verify the row */
2355 if (y > cur_hgt - hgt) y = cur_hgt - hgt;
2358 /* Verify the col */
2359 if (x > cur_wid - wid) x = cur_wid - wid;
2362 /* Handle "changes" */
2363 if ((y != panel_row_min) || (x != panel_col_min))
2365 /* Save the new panel info */
2369 /* Recalculate the boundaries */
2370 panel_bounds_center();
2373 p_ptr->update |= (PU_MONSTERS);
2376 p_ptr->redraw |= (PR_MAP);
2389 bool change_panel_xy(int y, int x)
2395 get_screen_size(&wid, &hgt);
2397 if (y < panel_row_min) dy = -1;
2398 if (y > panel_row_max) dy = 1;
2399 if (x < panel_col_min) dx = -1;
2400 if (x > panel_col_max) dx = 1;
2402 if (!dy && !dx) return (FALSE);
2404 return change_panel(dy, dx);
2409 * Given an row (y) and col (x), this routine detects when a move
2410 * off the screen has occurred and figures new borders. -RAK-
2412 * "Update" forces a "full update" to take place.
2414 * The map is reprinted if necessary, and "TRUE" is returned.
2416 void verify_panel(void)
2428 get_screen_size(&wid, &hgt);
2430 max_prow_min = cur_hgt - hgt;
2431 max_pcol_min = cur_wid - wid;
2433 /* Bounds checking */
2434 if (max_prow_min < 0) max_prow_min = 0;
2435 if (max_pcol_min < 0) max_pcol_min = 0;
2437 /* Center on player */
2438 if (center_player && (center_running || !running))
2440 /* Center vertically */
2441 prow_min = y - hgt / 2;
2442 if (prow_min < 0) prow_min = 0;
2443 else if (prow_min > max_prow_min) prow_min = max_prow_min;
2445 /* Center horizontally */
2446 pcol_min = x - wid / 2;
2447 if (pcol_min < 0) pcol_min = 0;
2448 else if (pcol_min > max_pcol_min) pcol_min = max_pcol_min;
2452 prow_min = panel_row_min;
2453 pcol_min = panel_col_min;
2455 /* Scroll screen when 2 grids from top/bottom edge */
2456 if (y > panel_row_max - 2)
2458 while (y > prow_min + hgt-1 - 2)
2460 prow_min += (hgt / 2);
2464 if (y < panel_row_min + 2)
2466 while (y < prow_min + 2)
2468 prow_min -= (hgt / 2);
2472 if (prow_min > max_prow_min) prow_min = max_prow_min;
2473 if (prow_min < 0) prow_min = 0;
2475 /* Scroll screen when 4 grids from left/right edge */
2476 if (x > panel_col_max - 4)
2478 while (x > pcol_min + wid-1 - 4)
2480 pcol_min += (wid / 2);
2484 if (x < panel_col_min + 4)
2486 while (x < pcol_min + 4)
2488 pcol_min -= (wid / 2);
2492 if (pcol_min > max_pcol_min) pcol_min = max_pcol_min;
2493 if (pcol_min < 0) pcol_min = 0;
2496 /* Check for "no change" */
2497 if ((prow_min == panel_row_min) && (pcol_min == panel_col_min)) return;
2499 /* Save the new panel info */
2500 panel_row_min = prow_min;
2501 panel_col_min = pcol_min;
2503 /* Hack -- optional disturb on "panel change" */
2504 if (disturb_panel && !center_player) disturb(0, 0);
2506 /* Recalculate the boundaries */
2507 panel_bounds_center();
2510 p_ptr->update |= (PU_MONSTERS);
2513 p_ptr->redraw |= (PR_MAP);
2516 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
2521 * Monster health description
2523 cptr look_mon_desc(monster_type *m_ptr, u32b mode)
2525 monster_race *ap_r_ptr = &r_info[m_ptr->ap_r_idx];
2532 /* Determine if the monster is "living" */
2533 living = monster_living(ap_r_ptr);
2535 /* Calculate a health "percentage" */
2536 perc = 100L * m_ptr->hp / m_ptr->maxhp;
2538 /* Healthy monsters */
2539 if (m_ptr->hp >= m_ptr->maxhp)
2543 desc = living ? "̵½ý" : "̵¥À¥á¡¼¥¸";
2545 desc = living ? "unhurt" : "undamaged";
2550 else if (perc >= 60)
2553 desc = living ? "·Ú½ý" : "¾®¥À¥á¡¼¥¸";
2555 desc = living ? "somewhat wounded" : "somewhat damaged";
2560 else if (perc >= 25)
2563 desc = living ? "Éé½ý" : "Ãæ¥À¥á¡¼¥¸";
2565 desc = living ? "wounded" : "damaged";
2570 else if (perc >= 10)
2573 desc = living ? "½Å½ý" : "Âç¥À¥á¡¼¥¸";
2575 desc = living ? "badly wounded" : "badly damaged";
2583 desc = living ? "Ⱦ»àȾÀ¸" : "Åݤ줫¤±";
2585 desc = living ? "almost dead" : "almost destroyed";
2590 /* Need attitude information? */
2593 /* Full information is not needed */
2596 else if (is_pet(m_ptr))
2599 attitude = ", ¥Ú¥Ã¥È";
2604 else if (is_friendly(m_ptr))
2607 attitude = ", ͧ¹¥Åª";
2609 attitude = ", friendly";
2622 /* Clone monster? */
2623 if (m_ptr->smart & SM_CLONED)
2632 /* Display monster's level --- idea borrowed from ToME */
2633 if (ap_r_ptr->r_tkills && !(m_ptr->mflag2 & MFLAG2_KAGE))
2636 return format("¥ì¥Ù¥ë%d, %s%s%s", ap_r_ptr->level, desc, attitude, clone);
2638 return format("Level %d, %s%s%s", ap_r_ptr->level, desc, attitude, clone);
2644 return format("¥ì¥Ù¥ë???, %s%s%s", desc, attitude, clone);
2646 return format("Level ???, %s%s%s", desc, attitude, clone);
2654 * Angband sorting algorithm -- quick sort in place
2656 * Note that the details of the data we are sorting is hidden,
2657 * and we rely on the "ang_sort_comp()" and "ang_sort_swap()"
2658 * function hooks to interact with the data, which is given as
2659 * two pointers, and which may have any user-defined form.
2661 void ang_sort_aux(vptr u, vptr v, int p, int q)
2679 while (!(*ang_sort_comp)(u, v, b, z)) b--;
2682 while (!(*ang_sort_comp)(u, v, z, a)) a++;
2684 /* Done partition */
2688 (*ang_sort_swap)(u, v, a, b);
2694 /* Recurse left side */
2695 ang_sort_aux(u, v, p, b);
2697 /* Recurse right side */
2698 ang_sort_aux(u, v, b+1, q);
2703 * Angband sorting algorithm -- quick sort in place
2705 * Note that the details of the data we are sorting is hidden,
2706 * and we rely on the "ang_sort_comp()" and "ang_sort_swap()"
2707 * function hooks to interact with the data, which is given as
2708 * two pointers, and which may have any user-defined form.
2710 void ang_sort(vptr u, vptr v, int n)
2712 /* Sort the array */
2713 ang_sort_aux(u, v, 0, n-1);
2718 /*** Targeting Code ***/
2722 * Determine is a monster makes a reasonable target
2724 * The concept of "targeting" was stolen from "Morgul" (?)
2726 * The player can target any location, or any "target-able" monster.
2728 * Currently, a monster is "target_able" if it is visible, and if
2729 * the player can hit it with a projection, and the player is not
2730 * hallucinating. This allows use of "use closest target" macros.
2732 * Future versions may restrict the ability to target "trappers"
2733 * and "mimics", but the semantics is a little bit weird.
2735 bool target_able(int m_idx)
2737 monster_type *m_ptr = &m_list[m_idx];
2739 /* Monster must be alive */
2740 if (!m_ptr->r_idx) return (FALSE);
2742 /* Hack -- no targeting hallucinations */
2743 if (p_ptr->image) return (FALSE);
2745 /* Monster must be visible */
2746 if (!m_ptr->ml) return (FALSE);
2748 if (p_ptr->riding && (p_ptr->riding == m_idx)) return (TRUE);
2750 /* Monster must be projectable */
2751 if (!projectable(py, px, m_ptr->fy, m_ptr->fx)) return (FALSE);
2753 /* XXX XXX XXX Hack -- Never target trappers */
2754 /* if (CLEAR_ATTR && (CLEAR_CHAR)) return (FALSE); */
2764 * Update (if necessary) and verify (if possible) the target.
2766 * We return TRUE if the target is "okay" and FALSE otherwise.
2768 bool target_okay(void)
2770 /* Accept stationary targets */
2771 if (target_who < 0) return (TRUE);
2773 /* Check moving targets */
2776 /* Accept reasonable targets */
2777 if (target_able(target_who))
2779 monster_type *m_ptr = &m_list[target_who];
2781 /* Acquire monster location */
2782 target_row = m_ptr->fy;
2783 target_col = m_ptr->fx;
2790 /* Assume no target */
2796 * Sorting hook -- comp function -- by "distance to player"
2798 * We use "u" and "v" to point to arrays of "x" and "y" positions,
2799 * and sort the arrays by double-distance to the player.
2801 static bool ang_sort_comp_distance(vptr u, vptr v, int a, int b)
2803 byte *x = (byte*)(u);
2804 byte *y = (byte*)(v);
2808 /* Absolute distance components */
2809 kx = x[a]; kx -= px; kx = ABS(kx);
2810 ky = y[a]; ky -= py; ky = ABS(ky);
2812 /* Approximate Double Distance to the first point */
2813 da = ((kx > ky) ? (kx + kx + ky) : (ky + ky + kx));
2815 /* Absolute distance components */
2816 kx = x[b]; kx -= px; kx = ABS(kx);
2817 ky = y[b]; ky -= py; ky = ABS(ky);
2819 /* Approximate Double Distance to the first point */
2820 db = ((kx > ky) ? (kx + kx + ky) : (ky + ky + kx));
2822 /* Compare the distances */
2828 * Sorting hook -- comp function -- by importance level of grids
2830 * We use "u" and "v" to point to arrays of "x" and "y" positions,
2831 * and sort the arrays by level of monster
2833 static bool ang_sort_comp_importance(vptr u, vptr v, int a, int b)
2835 byte *x = (byte*)(u);
2836 byte *y = (byte*)(v);
2837 cave_type *ca_ptr = &cave[y[a]][x[a]];
2838 cave_type *cb_ptr = &cave[y[b]][x[b]];
2839 monster_type *ma_ptr = &m_list[ca_ptr->m_idx];
2840 monster_type *mb_ptr = &m_list[cb_ptr->m_idx];
2841 monster_race *ap_ra_ptr, *ap_rb_ptr;
2843 /* The player grid */
2844 if (y[a] == py && x[a] == px) return TRUE;
2845 if (y[b] == py && x[b] == px) return FALSE;
2847 /* Extract monster race */
2848 if (ca_ptr->m_idx && ma_ptr->ml) ap_ra_ptr = &r_info[ma_ptr->ap_r_idx];
2849 else ap_ra_ptr = NULL;
2850 if (cb_ptr->m_idx && mb_ptr->ml) ap_rb_ptr = &r_info[mb_ptr->ap_r_idx];
2851 else ap_rb_ptr = NULL;
2853 if (ap_ra_ptr && !ap_rb_ptr) return TRUE;
2854 if (!ap_ra_ptr && ap_rb_ptr) return FALSE;
2856 /* Compare two monsters */
2857 if (ap_ra_ptr && ap_rb_ptr)
2859 /* Unique monsters first */
2860 if ((ap_ra_ptr->flags1 & RF1_UNIQUE) && !(ap_rb_ptr->flags1 & RF1_UNIQUE)) return TRUE;
2861 if (!(ap_ra_ptr->flags1 & RF1_UNIQUE) && (ap_rb_ptr->flags1 & RF1_UNIQUE)) return FALSE;
2863 /* Shadowers first (¤¢¤ä¤·¤¤±Æ) */
2864 if ((ma_ptr->mflag2 & MFLAG2_KAGE) && !(mb_ptr->mflag2 & MFLAG2_KAGE)) return TRUE;
2865 if (!(ma_ptr->mflag2 & MFLAG2_KAGE) && (mb_ptr->mflag2 & MFLAG2_KAGE)) return FALSE;
2867 /* Unknown monsters first */
2868 if (!ap_ra_ptr->r_tkills && ap_rb_ptr->r_tkills) return TRUE;
2869 if (ap_ra_ptr->r_tkills && !ap_rb_ptr->r_tkills) return FALSE;
2871 /* Higher level monsters first (if known) */
2872 if (ap_ra_ptr->r_tkills && ap_rb_ptr->r_tkills)
2874 if (ap_ra_ptr->level > ap_rb_ptr->level) return TRUE;
2875 if (ap_ra_ptr->level < ap_rb_ptr->level) return FALSE;
2878 /* Sort by index if all conditions are same */
2879 if (ma_ptr->ap_r_idx > mb_ptr->ap_r_idx) return TRUE;
2880 if (ma_ptr->ap_r_idx < mb_ptr->ap_r_idx) return FALSE;
2883 /* An object get higher priority */
2884 if (cave[y[a]][x[a]].o_idx && !cave[y[b]][x[b]].o_idx) return TRUE;
2885 if (!cave[y[a]][x[a]].o_idx && cave[y[b]][x[b]].o_idx) return FALSE;
2887 /* Priority from the terrain */
2888 if (f_info[ca_ptr->feat].priority > f_info[cb_ptr->feat].priority) return TRUE;
2889 if (f_info[ca_ptr->feat].priority < f_info[cb_ptr->feat].priority) return FALSE;
2891 /* If all conditions are same, compare distance */
2892 return ang_sort_comp_distance(u, v, a, b);
2897 * Sorting hook -- swap function -- by "distance to player"
2899 * We use "u" and "v" to point to arrays of "x" and "y" positions,
2900 * and sort the arrays by distance to the player.
2902 static void ang_sort_swap_distance(vptr u, vptr v, int a, int b)
2904 byte *x = (byte*)(u);
2905 byte *y = (byte*)(v);
2923 * Hack -- help "select" a location (see below)
2925 static s16b target_pick(int y1, int x1, int dy, int dx)
2929 int x2, y2, x3, y3, x4, y4;
2931 int b_i = -1, b_v = 9999;
2934 /* Scan the locations */
2935 for (i = 0; i < temp_n; i++)
2941 /* Directed distance */
2945 /* Verify quadrant */
2946 if (dx && (x3 * dx <= 0)) continue;
2947 if (dy && (y3 * dy <= 0)) continue;
2949 /* Absolute distance */
2953 /* Verify quadrant */
2954 if (dy && !dx && (x4 > y4)) continue;
2955 if (dx && !dy && (y4 > x4)) continue;
2957 /* Approximate Double Distance */
2958 v = ((x4 > y4) ? (x4 + x4 + y4) : (y4 + y4 + x4));
2960 /* XXX XXX XXX Penalize location */
2963 if ((b_i >= 0) && (v >= b_v)) continue;
2975 * Hack -- determine if a given location is "interesting"
2977 static bool target_set_accept(int y, int x)
2981 s16b this_o_idx, next_o_idx = 0;
2984 if (!(in_bounds(y, x))) return (FALSE);
2986 /* Player grid is always interesting */
2987 if (player_bold(y, x)) return (TRUE);
2990 /* Handle hallucination */
2991 if (p_ptr->image) return (FALSE);
2994 /* Examine the grid */
2995 c_ptr = &cave[y][x];
2997 /* Visible monsters */
3000 monster_type *m_ptr = &m_list[c_ptr->m_idx];
3002 /* Visible monsters */
3003 if (m_ptr->ml) return (TRUE);
3006 /* Scan all objects in the grid */
3007 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
3011 /* Acquire object */
3012 o_ptr = &o_list[this_o_idx];
3014 /* Acquire next object */
3015 next_o_idx = o_ptr->next_o_idx;
3017 /* Memorized object */
3018 if (o_ptr->marked & OM_FOUND) return (TRUE);
3021 /* Interesting memorized features */
3022 if (c_ptr->info & (CAVE_MARK))
3024 /* Notice object features */
3025 if (c_ptr->info & CAVE_OBJECT) return (TRUE);
3027 /* Feature code (applying "mimic" field) */
3028 if (have_flag(f_info[get_feat_mimic(c_ptr)].flags, FF_NOTICE)) return TRUE;
3037 * Prepare the "temp" array for "target_set"
3039 * Return the number of target_able monsters in the set.
3041 static void target_set_prepare(int mode)
3044 int min_hgt, max_hgt, min_wid, max_wid;
3046 if (mode & TARGET_KILL)
3049 min_hgt = MAX((py - MAX_RANGE), 0);
3050 max_hgt = MIN((py + MAX_RANGE), cur_hgt - 1);
3051 min_wid = MAX((px - MAX_RANGE), 0);
3052 max_wid = MIN((px + MAX_RANGE), cur_wid - 1);
3054 else /* not targetting */
3057 min_hgt = panel_row_min;
3058 max_hgt = panel_row_max;
3059 min_wid = panel_col_min;
3060 max_wid = panel_col_max;
3063 /* Reset "temp" array */
3066 /* Scan the current panel */
3067 for (y = min_hgt; y <= max_hgt; y++)
3069 for (x = min_wid; x <= max_wid; x++)
3073 /* Require "interesting" contents */
3074 if (!target_set_accept(y, x)) continue;
3076 c_ptr = &cave[y][x];
3078 /* Require target_able monsters for "TARGET_KILL" */
3079 if ((mode & (TARGET_KILL)) && !target_able(c_ptr->m_idx)) continue;
3081 if ((mode & (TARGET_KILL)) && !target_pet && is_pet(&m_list[c_ptr->m_idx])) continue;
3083 /* Save the location */
3090 /* Set the sort hooks */
3091 if (mode & (TARGET_KILL))
3093 /* Target the nearest monster for shooting */
3094 ang_sort_comp = ang_sort_comp_distance;
3095 ang_sort_swap = ang_sort_swap_distance;
3099 /* Look important grids first in Look command */
3100 ang_sort_comp = ang_sort_comp_importance;
3101 ang_sort_swap = ang_sort_swap_distance;
3104 /* Sort the positions */
3105 ang_sort(temp_x, temp_y, temp_n);
3107 if (p_ptr->riding && target_pet && (temp_n > 1) && (mode & (TARGET_KILL)))
3112 temp_y[0] = temp_y[1];
3115 temp_x[0] = temp_x[1];
3119 void target_set_prepare_look(){
3120 target_set_prepare(TARGET_LOOK);
3125 * Evaluate number of kill needed to gain level
3127 static void evaluate_monster_exp(char *buf, monster_type *m_ptr)
3129 monster_race *ap_r_ptr = &r_info[m_ptr->ap_r_idx];
3131 s32b exp_mon, exp_adv;
3132 u32b exp_mon_frac, exp_adv_frac;
3134 if ((p_ptr->lev >= PY_MAX_LEVEL) || (p_ptr->prace == RACE_ANDROID))
3139 else if (!ap_r_ptr->r_tkills || (m_ptr->mflag2 & MFLAG2_KAGE))
3149 /* The monster's experience point (assuming average monster speed) */
3150 exp_mon = ap_r_ptr->mexp * ap_r_ptr->level;
3152 s64b_div(&exp_mon, &exp_mon_frac, 0, (p_ptr->max_plv + 2));
3155 /* Total experience value for next level */
3156 exp_adv = player_exp[p_ptr->lev -1] * p_ptr->expfact;
3158 s64b_div(&exp_adv, &exp_adv_frac, 0, 100);
3160 /* Experience value need to get */
3161 s64b_sub(&exp_adv, &exp_adv_frac, p_ptr->exp, p_ptr->exp_frac);
3164 /* You need to kill at least one monster to get any experience */
3165 s64b_add(&exp_adv, &exp_adv_frac, exp_mon, exp_mon_frac);
3166 s64b_sub(&exp_adv, &exp_adv_frac, 0, 1);
3168 /* Extract number of monsters needed */
3169 s64b_div(&exp_adv, &exp_adv_frac, exp_mon, exp_mon_frac);
3171 /* If 999 or more monsters needed, only display "999". */
3172 num = MIN(999, exp_adv_frac);
3174 /* Display the number */
3175 sprintf(buf,"%03ld", (long int)num);
3179 bool show_gold_on_floor = FALSE;
3182 * Examine a grid, return a keypress.
3184 * The "mode" argument contains the "TARGET_LOOK" bit flag, which
3185 * indicates that the "space" key should scan through the contents
3186 * of the grid, instead of simply returning immediately. This lets
3187 * the "look" command get complete information, without making the
3188 * "target" command annoying.
3190 * The "info" argument contains the "commands" which should be shown
3191 * inside the "[xxx]" text. This string must never be empty, or grids
3192 * containing monsters will be displayed with an extra comma.
3194 * Note that if a monster is in the grid, we update both the monster
3195 * recall info and the health bar info to track that monster.
3197 * Eventually, we may allow multiple objects per grid, or objects
3198 * and terrain features in the same grid. XXX XXX XXX
3200 * This function must handle blindness/hallucination.
3202 static int target_set_aux(int y, int x, int mode, cptr info)
3204 cave_type *c_ptr = &cave[y][x];
3205 s16b this_o_idx, next_o_idx = 0;
3206 cptr s1 = "", s2 = "", s3 = "", x_info = "";
3209 feature_type *f_ptr;
3211 char out_val[MAX_NLEN+80];
3213 #ifdef ALLOW_EASY_FLOOR
3214 int floor_list[23], floor_num = 0;
3216 /* Scan all objects in the grid */
3219 floor_num = scan_floor(floor_list, y, x, 0x02);
3231 #endif /* ALLOW_EASY_FLOOR */
3233 /* Hack -- under the player */
3234 if (player_bold(y, x))
3257 /* Hack -- hallucination */
3261 cptr name = "²¿¤«´ñ̯¤Êʪ";
3263 cptr name = "something strange";
3267 /* Display a message */
3269 sprintf(out_val, "%s%s%s%s [%s]", s1, name, s2, s3, info);
3271 sprintf(out_val, "%s%s%s%s [%s]", s1, s2, s3, name, info);
3275 move_cursor_relative(y, x);
3278 /* Stop on everything but "return" */
3279 if ((query != '\r') && (query != '\n')) return query;
3281 /* Repeat forever */
3286 /* Actual monsters */
3287 if (c_ptr->m_idx && m_list[c_ptr->m_idx].ml)
3289 monster_type *m_ptr = &m_list[c_ptr->m_idx];
3290 monster_race *ap_r_ptr = &r_info[m_ptr->ap_r_idx];
3292 bool recall = FALSE;
3297 /* Get the monster name ("a kobold") */
3298 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
3300 /* Hack -- track this monster race */
3301 monster_race_track(m_ptr->ap_r_idx);
3303 /* Hack -- health bar for this monster */
3304 health_track(c_ptr->m_idx);
3306 /* Hack -- handle stuff */
3320 /* Recall on screen */
3321 screen_roff(m_ptr->ap_r_idx, 0);
3323 /* Hack -- Complete the prompt (again) */
3325 Term_addstr(-1, TERM_WHITE, format(" [r»× %s%s]", x_info, info));
3327 Term_addstr(-1, TERM_WHITE, format(" [r,%s%s]", x_info, info));
3336 /* Normal commands */
3337 if (query != 'r') break;
3342 /* Cleare recall text and repeat */
3348 /* Describe, and prompt for recall */
3349 evaluate_monster_exp(acount, m_ptr);
3352 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);
3354 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);
3360 move_cursor_relative(y, x);
3365 /* Normal commands */
3366 if (query != 'r') break;
3372 /* Always stop at "normal" keys */
3373 if ((query != '\r') && (query != '\n') && (query != ' ') && (query != 'x')) return query;
3375 /* Sometimes stop at "space" key */
3376 if ((query == ' ') && !(mode & (TARGET_LOOK))) return query;
3378 /* Change the intro */
3386 /* Hack -- take account of gender */
3388 if (ap_r_ptr->flags1 & (RF1_FEMALE)) s1 = "Èà½÷¤Ï";
3390 if (ap_r_ptr->flags1 & (RF1_FEMALE)) s1 = "She is ";
3394 else if (ap_r_ptr->flags1 & (RF1_MALE)) s1 = "Èà¤Ï";
3396 else if (ap_r_ptr->flags1 & (RF1_MALE)) s1 = "He is ";
3400 /* Use a preposition */
3409 /* Scan all objects being carried */
3410 for (this_o_idx = m_ptr->hold_o_idx; this_o_idx; this_o_idx = next_o_idx)
3412 char o_name[MAX_NLEN];
3416 /* Acquire object */
3417 o_ptr = &o_list[this_o_idx];
3419 /* Acquire next object */
3420 next_o_idx = o_ptr->next_o_idx;
3422 /* Obtain an object description */
3423 object_desc(o_name, o_ptr, 0);
3425 /* Describe the object */
3427 sprintf(out_val, "%s%s%s%s[%s]", s1, o_name, s2, s3, info);
3429 sprintf(out_val, "%s%s%s%s [%s]", s1, s2, s3, o_name, info);
3433 move_cursor_relative(y, x);
3436 /* Always stop at "normal" keys */
3437 if ((query != '\r') && (query != '\n') && (query != ' ') && (query != 'x')) return query;
3439 /* Sometimes stop at "space" key */
3440 if ((query == ' ') && !(mode & (TARGET_LOOK))) return query;
3442 /* Change the intro */
3446 s2 = "also carrying ";
3450 /* Use a preposition */
3460 #ifdef ALLOW_EASY_FLOOR
3469 char o_name[MAX_NLEN];
3473 /* Acquire object */
3474 o_ptr = &o_list[floor_list[0]];
3476 /* Describe the object */
3477 object_desc(o_name, o_ptr, 0);
3481 sprintf(out_val, "%s%s%s%s[%s]",
3482 s1, o_name, s2, s3, info);
3484 sprintf(out_val, "%s%s%s%s [%s]",
3485 s1, s2, s3, o_name, info);
3489 move_cursor_relative(y, x);
3498 /* Provide one cushion before item listing */
3501 /* Display rough information about items */
3503 sprintf(out_val, "%s %d¸Ä¤Î¥¢¥¤¥Æ¥à%s%s ['x'¤Ç°ìÍ÷, %s]",
3504 s1, floor_num, s2, s3, info);
3506 sprintf(out_val, "%s%s%sa pile of %d items [x,%s]",
3507 s1, s2, s3, floor_num, info);
3511 move_cursor_relative(y, x);
3516 /* No request for listing */
3517 if (query != 'x' && query != ' ') return query;
3521 /** Display list of items **/
3523 /* Continue scrolling list if requested */
3532 show_gold_on_floor = TRUE;
3533 (void)show_floor(0, y, x, &min_width);
3534 show_gold_on_floor = FALSE;
3538 sprintf(out_val, "%s %d¸Ä¤Î¥¢¥¤¥Æ¥à%s%s [Enter¤Ç¼¡¤Ø, %s]",
3539 s1, floor_num, s2, s3, info);
3541 sprintf(out_val, "%s%s%sa pile of %d items [Enter,%s]",
3542 s1, s2, s3, floor_num, info);
3553 /* Exit unless 'Enter' */
3554 if (query != '\n' && query != '\r')
3559 /* Get the object being moved. */
3560 o_idx = c_ptr->o_idx;
3562 /* Only rotate a pile of two or more objects. */
3563 if (!(o_idx && o_list[o_idx].next_o_idx)) continue;
3565 /* Remove the first object from the list. */
3566 excise_object_idx(o_idx);
3568 /* Find end of the list. */
3570 while (o_list[i].next_o_idx)
3571 i = o_list[i].next_o_idx;
3573 /* Add after the last object. */
3574 o_list[i].next_o_idx = o_idx;
3576 /* Loop and re-display the list */
3582 #endif /* ALLOW_EASY_FLOOR */
3585 /* Scan all objects in the grid */
3586 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
3590 /* Acquire object */
3591 o_ptr = &o_list[this_o_idx];
3593 /* Acquire next object */
3594 next_o_idx = o_ptr->next_o_idx;
3597 if (o_ptr->marked & OM_FOUND)
3599 char o_name[MAX_NLEN];
3604 /* Obtain an object description */
3605 object_desc(o_name, o_ptr, 0);
3607 /* Describe the object */
3609 sprintf(out_val, "%s%s%s%s[%s]", s1, o_name, s2, s3, info);
3611 sprintf(out_val, "%s%s%s%s [%s]", s1, s2, s3, o_name, info);
3615 move_cursor_relative(y, x);
3618 /* Always stop at "normal" keys */
3619 if ((query != '\r') && (query != '\n') && (query != ' ') && (query != 'x')) return query;
3621 /* Sometimes stop at "space" key */
3622 if ((query == ' ') && !(mode & TARGET_LOOK)) return query;
3624 /* Change the intro */
3634 if (o_ptr->number != 1) s1 = "¤½¤ì¤é¤Ï";
3636 if (o_ptr->number != 1) s1 = "They are ";
3652 /* Feature code (applying "mimic" field) */
3653 feat = get_feat_mimic(c_ptr);
3655 /* Require knowledge about grid, or ability to see grid */
3656 if (!(c_ptr->info & CAVE_MARK) && !player_can_see_bold(y, x))
3658 /* Forget feature */
3662 f_ptr = &f_info[feat];
3664 /* Terrain feature if needed */
3665 if (boring || have_flag(f_ptr->flags, FF_REMEMBER))
3669 /* Hack -- special handling for quest entrances */
3670 if (have_flag(f_ptr->flags, FF_QUEST_ENTER))
3672 /* Set the quest number temporary */
3673 int old_quest = p_ptr->inside_quest;
3676 /* Clear the text */
3677 for (j = 0; j < 10; j++) quest_text[j][0] = '\0';
3678 quest_text_line = 0;
3680 p_ptr->inside_quest = c_ptr->special;
3682 /* Get the quest text */
3683 init_flags = INIT_NAME_ONLY;
3685 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
3688 name = format("¥¯¥¨¥¹¥È¡Ö%s¡×(%d³¬ÁêÅö)", quest[c_ptr->special].name, quest[c_ptr->special].level);
3690 name = format("the entrance to the quest '%s'(level %d)", quest[c_ptr->special].name, quest[c_ptr->special].level);
3693 /* Reset the old quest number */
3694 p_ptr->inside_quest = old_quest;
3697 /* Hack -- special handling for building doors */
3698 else if (have_flag(f_ptr->flags, FF_BLDG) && !p_ptr->inside_arena)
3700 name = building[f_ptr->subtype].name;
3702 else if (have_flag(f_ptr->flags, FF_ENTRANCE))
3705 name = format("%s(%d³¬ÁêÅö)", d_text + d_info[c_ptr->special].text, d_info[c_ptr->special].mindepth);
3707 name = format("%s(level %d)", d_text + d_info[c_ptr->special].text, d_info[c_ptr->special].mindepth);
3710 else if (have_flag(f_ptr->flags, FF_TOWN))
3712 name = town[c_ptr->special].name;
3714 else if (p_ptr->wild_mode && (feat == feat_floor))
3724 name = f_name + f_ptr->name;
3730 ((!have_flag(f_ptr->flags, FF_MOVE) && !have_flag(f_ptr->flags, FF_CAN_FLY)) ||
3731 (!have_flag(f_ptr->flags, FF_LOS) && !have_flag(f_ptr->flags, FF_TREE)) ||
3732 have_flag(f_ptr->flags, FF_TOWN)))
3741 /* Hack -- special introduction for store & building doors -KMW- */
3742 if (have_flag(f_ptr->flags, FF_STORE) ||
3743 have_flag(f_ptr->flags, FF_QUEST_ENTER) ||
3744 (have_flag(f_ptr->flags, FF_BLDG) && !p_ptr->inside_arena) ||
3745 have_flag(f_ptr->flags, FF_ENTRANCE))
3754 else if (have_flag(f_ptr->flags, FF_FLOOR) ||
3755 have_flag(f_ptr->flags, FF_TOWN) ||
3756 have_flag(f_ptr->flags, FF_SHALLOW) ||
3757 have_flag(f_ptr->flags, FF_DEEP))
3763 /* Pick proper indefinite article */
3764 s3 = (is_a_vowel(name[0])) ? "an " : "a ";
3768 /* Display a message */
3772 if (c_ptr->mimic) sprintf(f_idx_str, "%d/%d", c_ptr->feat, c_ptr->mimic);
3773 else sprintf(f_idx_str, "%d", c_ptr->feat);
3775 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]);
3777 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);
3782 sprintf(out_val, "%s%s%s%s[%s]", s1, name, s2, s3, info);
3784 sprintf(out_val, "%s%s%s%s [%s]", s1, s2, s3, name, info);
3788 move_cursor_relative(y, x);
3791 /* Always stop at "normal" keys */
3792 if ((query != '\r') && (query != '\n') && (query != ' ')) return query;
3795 /* Stop on everything but "return" */
3796 if ((query != '\r') && (query != '\n')) return query;
3798 /* Repeat forever */
3804 * Handle "target" and "look".
3806 * Note that this code can be called from "get_aim_dir()".
3808 * All locations must be on the current panel. Consider the use of
3809 * "panel_bounds()" to allow "off-panel" targets, perhaps by using
3810 * some form of "scrolling" the map around the cursor. XXX XXX XXX
3811 * That is, consider the possibility of "auto-scrolling" the screen
3812 * while the cursor moves around. This may require changes in the
3813 * "update_mon()" code to allow "visibility" even if off panel, and
3814 * may require dynamic recalculation of the "temp" grid set.
3816 * Hack -- targeting/observing an "outer border grid" may induce
3817 * problems, so this is not currently allowed.
3819 * The player can use the direction keys to move among "interesting"
3820 * grids in a heuristic manner, or the "space", "+", and "-" keys to
3821 * move through the "interesting" grids in a sequential manner, or
3822 * can enter "location" mode, and use the direction keys to move one
3823 * grid at a time in any direction. The "t" (set target) command will
3824 * only target a monster (as opposed to a location) if the monster is
3825 * target_able and the "interesting" mode is being used.
3827 * The current grid is described using the "look" method above, and
3828 * a new command may be entered at any time, but note that if the
3829 * "TARGET_LOOK" bit flag is set (or if we are in "location" mode,
3830 * where "space" has no obvious meaning) then "space" will scan
3831 * through the description of the current grid until done, instead
3832 * of immediately jumping to the next "interesting" grid. This
3833 * allows the "target" command to retain its old semantics.
3835 * The "*", "+", and "-" keys may always be used to jump immediately
3836 * to the next (or previous) interesting grid, in the proper mode.
3838 * The "return" key may always be used to scan through a complete
3839 * grid description (forever).
3841 * This command will cancel any old target, even if used from
3842 * inside the "look" command.
3844 bool target_set(int mode)
3863 get_screen_size(&wid, &hgt);
3869 /* Cancel tracking */
3870 /* health_track(0); */
3873 /* Prepare the "temp" array */
3874 target_set_prepare(mode);
3876 /* Start near the player */
3882 /* Interesting grids */
3889 change_panel_xy(y, x);
3891 if (!(mode & TARGET_LOOK)) prt_path(y, x);
3894 c_ptr = &cave[y][x];
3897 if (target_able(c_ptr->m_idx))
3900 strcpy(info, "q»ß t·è p¼« o¸½ +¼¡ -Á°");
3902 strcpy(info, "q,t,p,o,+,-,<dir>");
3907 /* Dis-allow target */
3911 strcpy(info, "q»ß p¼« o¸½ +¼¡ -Á°");
3913 strcpy(info, "q,p,o,+,-,<dir>");
3918 /* Describe and Prompt */
3920 query = target_set_aux(y, x, mode, info);
3924 /* Cancel tracking */
3925 /* health_track(0); */
3927 /* Assume no "direction" */
3932 if (query == '\r') query = 't';
3950 if (target_able(c_ptr->m_idx))
3952 health_track(c_ptr->m_idx);
3953 target_who = c_ptr->m_idx;
3972 if (!expand_list) done = TRUE;
3982 if (!expand_list) done = TRUE;
3989 /* Recenter the map around the player */
3993 p_ptr->update |= (PU_MONSTERS);
3996 p_ptr->redraw |= (PR_MAP);
3999 p_ptr->window |= (PW_OVERHEAD);
4004 /* Recalculate interesting grids */
4005 target_set_prepare(mode);
4024 /* Extract the action (if any) */
4025 d = get_keymap_dir(query);
4032 /* Hack -- move around */
4035 /* Modified to scroll to monster */
4036 int y2 = panel_row_min;
4037 int x2 = panel_col_min;
4039 /* Find a new monster */
4040 i = target_pick(temp_y[m], temp_x[m], ddy[d], ddx[d]);
4042 /* Request to target past last interesting grid */
4043 while (flag && (i < 0))
4045 /* Note the change */
4046 if (change_panel(ddy[d], ddx[d]))
4051 /* Recalculate interesting grids */
4052 target_set_prepare(mode);
4054 /* Look at interesting grids */
4057 /* Find a new monster */
4058 i = target_pick(v, u, ddy[d], ddx[d]);
4064 /* Nothing interesting */
4070 /* Restore previous position */
4073 panel_bounds_center();
4076 p_ptr->update |= (PU_MONSTERS);
4079 p_ptr->redraw |= (PR_MAP);
4082 p_ptr->window |= (PW_OVERHEAD);
4087 /* Recalculate interesting grids */
4088 target_set_prepare(mode);
4090 /* Look at boring grids */
4097 /* Do not move horizontally if unnecessary */
4098 if (((x < panel_col_min + wid / 2) && (dx > 0)) ||
4099 ((x > panel_col_min + wid / 2) && (dx < 0)))
4104 /* Do not move vertically if unnecessary */
4105 if (((y < panel_row_min + hgt / 2) && (dy > 0)) ||
4106 ((y > panel_row_min + hgt / 2) && (dy < 0)))
4111 /* Apply the motion */
4112 if ((y >= panel_row_min+hgt) || (y < panel_row_min) ||
4113 (x >= panel_col_min+wid) || (x < panel_col_min))
4115 if (change_panel(dy, dx)) target_set_prepare(mode);
4118 /* Slide into legality */
4119 if (x >= cur_wid-1) x = cur_wid - 2;
4120 else if (x <= 0) x = 1;
4122 /* Slide into legality */
4123 if (y >= cur_hgt-1) y = cur_hgt- 2;
4124 else if (y <= 0) y = 1;
4133 /* Arbitrary grids */
4136 bool move_fast = FALSE;
4138 if (!(mode & TARGET_LOOK)) prt_path(y, x);
4141 c_ptr = &cave[y][x];
4143 /* Default prompt */
4145 strcpy(info, "q»ß t·è p¼« m¶á +¼¡ -Á°");
4147 strcpy(info, "q,t,p,m,+,-,<dir>");
4151 /* Describe and Prompt (enable "TARGET_LOOK") */
4152 while (!(query = target_set_aux(y, x, mode | TARGET_LOOK, info)));
4154 /* Cancel tracking */
4155 /* health_track(0); */
4157 /* Assume no direction */
4162 if (query == '\r') query = 't';
4165 /* Analyze the keypress */
4189 /* Recenter the map around the player */
4193 p_ptr->update |= (PU_MONSTERS);
4196 p_ptr->redraw |= (PR_MAP);
4199 p_ptr->window |= (PW_OVERHEAD);
4204 /* Recalculate interesting grids */
4205 target_set_prepare(mode);
4227 /* Pick a nearby monster */
4228 for (i = 0; i < temp_n; i++)
4230 t = distance(y, x, temp_y[i], temp_x[i]);
4240 /* Nothing interesting */
4241 if (bd == 999) flag = FALSE;
4248 /* Extract the action (if any) */
4249 d = get_keymap_dir(query);
4251 /* XTRA HACK MOVEFAST */
4252 if (isupper(query)) move_fast = TRUE;
4259 /* Handle "direction" */
4265 /* XTRA HACK MOVEFAST */
4268 int mag = MIN(wid / 2, hgt / 2);
4278 /* Do not move horizontally if unnecessary */
4279 if (((x < panel_col_min + wid / 2) && (dx > 0)) ||
4280 ((x > panel_col_min + wid / 2) && (dx < 0)))
4285 /* Do not move vertically if unnecessary */
4286 if (((y < panel_row_min + hgt / 2) && (dy > 0)) ||
4287 ((y > panel_row_min + hgt / 2) && (dy < 0)))
4292 /* Apply the motion */
4293 if ((y >= panel_row_min + hgt) || (y < panel_row_min) ||
4294 (x >= panel_col_min + wid) || (x < panel_col_min))
4296 if (change_panel(dy, dx)) target_set_prepare(mode);
4299 /* Slide into legality */
4300 if (x >= cur_wid-1) x = cur_wid - 2;
4301 else if (x <= 0) x = 1;
4303 /* Slide into legality */
4304 if (y >= cur_hgt-1) y = cur_hgt- 2;
4305 else if (y <= 0) y = 1;
4313 /* Clear the top line */
4316 /* Recenter the map around the player */
4320 p_ptr->update |= (PU_MONSTERS);
4323 p_ptr->redraw |= (PR_MAP);
4326 p_ptr->window |= (PW_OVERHEAD);
4331 /* Failure to set target */
4332 if (!target_who) return (FALSE);
4340 * Get an "aiming direction" from the user.
4342 * The "dir" is loaded with 1,2,3,4,6,7,8,9 for "actual direction", and
4343 * "0" for "current target", and "-1" for "entry aborted".
4345 * Note that "Force Target", if set, will pre-empt user interaction,
4346 * if there is a usable target already set.
4348 * Note that confusion over-rides any (explicit?) user choice.
4350 bool get_aim_dir(int *dp)
4361 /* Global direction */
4364 /* Hack -- auto-target if requested */
4365 if (use_old_target && target_okay()) dir = 5;
4367 #ifdef ALLOW_REPEAT /* TNB */
4369 if (repeat_pull(dp))
4374 if (!(*dp == 5 && !target_okay()))
4376 /* return (TRUE); */
4381 #endif /* ALLOW_REPEAT -- TNB */
4383 /* Ask until satisfied */
4386 /* Choose a prompt */
4390 p = "Êý¸þ ('*'¤Ç¥¿¡¼¥²¥Ã¥ÈÁªÂò, ESC¤ÇÃæÃÇ)? ";
4392 p = "Direction ('*' to choose a target, Escape to cancel)? ";
4399 p = "Êý¸þ ('5'¤Ç¥¿¡¼¥²¥Ã¥È¤Ø, '*'¤Ç¥¿¡¼¥²¥Ã¥ÈºÆÁªÂò, ESC¤ÇÃæÃÇ)? ";
4401 p = "Direction ('5' for target, '*' to re-target, Escape to cancel)? ";
4406 /* Get a command (or Cancel) */
4407 if (!get_com(p, &command, TRUE)) break;
4411 if (command == '\r') command = 't';
4414 /* Convert various keys to "standard" keys */
4417 /* Use current target */
4428 /* Set new target */
4433 if (target_set(TARGET_KILL)) dir = 5;
4439 /* Extract the action (if any) */
4440 dir = get_keymap_dir(command);
4446 /* Verify requested targets */
4447 if ((dir == 5) && !target_okay()) dir = 0;
4456 project_length = 0; /* reset to default */
4460 /* Save the direction */
4463 /* Check for confusion */
4464 if (p_ptr->confused)
4467 /* Random direction */
4468 dir = ddd[randint0(8)];
4471 /* Notice confusion */
4472 if (command_dir != dir)
4476 msg_print("¤¢¤Ê¤¿¤Ïº®Í𤷤Ƥ¤¤ë¡£");
4478 msg_print("You are confused.");
4483 /* Save direction */
4486 #ifdef ALLOW_REPEAT /* TNB */
4488 /* repeat_push(dir); */
4489 repeat_push(command_dir);
4491 #endif /* ALLOW_REPEAT -- TNB */
4493 /* A "valid" direction was entered */
4500 * Request a "movement" direction (1,2,3,4,6,7,8,9) from the user,
4501 * and place it into "command_dir", unless we already have one.
4503 * This function should be used for all "repeatable" commands, such as
4504 * run, walk, open, close, bash, disarm, spike, tunnel, etc, as well
4505 * as all commands which must reference a grid adjacent to the player,
4506 * and which may not reference the grid under the player. Note that,
4507 * for example, it is no longer possible to "disarm" or "open" chests
4508 * in the same grid as the player.
4510 * Direction "5" is illegal and will (cleanly) abort the command.
4512 * This function tracks and uses the "global direction", and uses
4513 * that as the "desired direction", to which "confusion" is applied.
4515 bool get_rep_dir(int *dp, bool under)
4523 /* Global direction */
4526 #ifdef ALLOW_REPEAT /* TNB */
4528 if (repeat_pull(dp))
4531 /* return (TRUE); */
4534 #endif /* ALLOW_REPEAT -- TNB */
4538 prompt = _("Êý¸þ ('.'¸µ, ESC¤ÇÃæÃÇ)? ", "Direction ('.' at feet, Escape to cancel)? ");
4542 prompt = _("Êý¸þ (ESC¤ÇÃæÃÇ)? ", "Direction (Escape to cancel)? ");
4545 /* Get a direction */
4550 /* Get a command (or Cancel) */
4551 if (!get_com(prompt, &ch, TRUE)) break;
4554 if ((under) && ((ch == '5') || (ch == '-') || (ch == '.')))
4560 /* Look up the direction */
4561 dir = get_keymap_dir(ch);
4568 /* Prevent weirdness */
4569 if ((dir == 5) && (!under)) dir = 0;
4572 if (!dir) return (FALSE);
4574 /* Save desired direction */
4577 /* Apply "confusion" */
4578 if (p_ptr->confused)
4580 /* Standard confusion */
4581 if (randint0(100) < 75)
4583 /* Random direction */
4584 dir = ddd[randint0(8)];
4587 else if (p_ptr->riding)
4589 monster_type *m_ptr = &m_list[p_ptr->riding];
4590 monster_race *r_ptr = &r_info[m_ptr->r_idx];
4592 if (MON_CONFUSED(m_ptr))
4594 /* Standard confusion */
4595 if (randint0(100) < 75)
4597 /* Random direction */
4598 dir = ddd[randint0(8)];
4601 else if ((r_ptr->flags1 & RF1_RAND_50) && (r_ptr->flags1 & RF1_RAND_25) && (randint0(100) < 50))
4603 /* Random direction */
4604 dir = ddd[randint0(8)];
4606 else if ((r_ptr->flags1 & RF1_RAND_50) && (randint0(100) < 25))
4608 /* Random direction */
4609 dir = ddd[randint0(8)];
4613 /* Notice confusion */
4614 if (command_dir != dir)
4616 if (p_ptr->confused)
4620 msg_print("¤¢¤Ê¤¿¤Ïº®Í𤷤Ƥ¤¤ë¡£");
4622 msg_print("You are confused.");
4628 monster_type *m_ptr = &m_list[p_ptr->riding];
4630 monster_desc(m_name, m_ptr, 0);
4631 if (MON_CONFUSED(m_ptr))
4634 msg_format("%s¤Ïº®Í𤷤Ƥ¤¤ë¡£", m_name);
4636 msg_format("%^s is confusing.", m_name);
4643 msg_format("%s¤Ï»×¤¤Ä̤ê¤ËÆ°¤¤¤Æ¤¯¤ì¤Ê¤¤¡£", m_name);
4645 msg_format("You cannot control %s.", m_name);
4651 /* Save direction */
4654 #ifdef ALLOW_REPEAT /* TNB */
4656 /* repeat_push(dir); */
4657 repeat_push(command_dir);
4659 #endif /* ALLOW_REPEAT -- TNB */
4666 bool get_rep_dir2(int *dp)
4673 /* Global direction */
4676 #ifdef ALLOW_REPEAT /* TNB */
4678 if (repeat_pull(dp))
4681 /* return (TRUE); */
4684 #endif /* ALLOW_REPEAT -- TNB */
4686 /* Get a direction */
4691 /* Get a command (or Cancel) */
4693 if (!get_com("Êý¸þ (ESC¤ÇÃæÃÇ)? ", &ch, TRUE)) break;
4695 if (!get_com("Direction (Escape to cancel)? ", &ch, TRUE)) break;
4699 /* Look up the direction */
4700 dir = get_keymap_dir(ch);
4706 /* Prevent weirdness */
4707 if (dir == 5) dir = 0;
4710 if (!dir) return (FALSE);
4712 /* Save desired direction */
4715 /* Apply "confusion" */
4716 if (p_ptr->confused)
4718 /* Standard confusion */
4719 if (randint0(100) < 75)
4721 /* Random direction */
4722 dir = ddd[randint0(8)];
4726 /* Notice confusion */
4727 if (command_dir != dir)
4731 msg_print("¤¢¤Ê¤¿¤Ïº®Í𤷤Ƥ¤¤ë¡£");
4733 msg_print("You are confused.");
4738 /* Save direction */
4741 #ifdef ALLOW_REPEAT /* TNB */
4743 /* repeat_push(dir); */
4744 repeat_push(command_dir);
4746 #endif /* ALLOW_REPEAT -- TNB */
4752 void gain_level_reward(int chosen_reward)
4756 char wrath_reason[32] = "";
4757 int nasty_chance = 6;
4758 int dummy = 0, dummy2 = 0;
4761 char o_name[MAX_NLEN];
4767 if (multi_rew) return;
4768 else multi_rew = TRUE;
4772 if (p_ptr->lev == 13) nasty_chance = 2;
4773 else if (!(p_ptr->lev % 13)) nasty_chance = 3;
4774 else if (!(p_ptr->lev % 14)) nasty_chance = 12;
4776 if (one_in_(nasty_chance))
4777 type = randint1(20); /* Allow the 'nasty' effects */
4779 type = randint1(15) + 5; /* Or disallow them */
4781 if (type < 1) type = 1;
4782 if (type > 20) type = 20;
4787 sprintf(wrath_reason, "%s¤ÎÅܤê",
4788 chaos_patrons[p_ptr->chaos_patron]);
4790 sprintf(wrath_reason, "the Wrath of %s",
4791 chaos_patrons[p_ptr->chaos_patron]);
4795 effect = chaos_rewards[p_ptr->chaos_patron][type];
4797 if (one_in_(6) && !chosen_reward)
4800 msg_format("%^s¤ÏË«Èþ¤È¤·¤Æ¤¢¤Ê¤¿¤òÆÍÁ³ÊÑ°Û¤µ¤»¤¿¡£",
4801 chaos_patrons[p_ptr->chaos_patron]);
4803 msg_format("%^s rewards you with a mutation!",
4804 chaos_patrons[p_ptr->chaos_patron]);
4807 (void)gain_random_mutation(0);
4809 reward = "ÊÑ°Û¤·¤¿¡£";
4811 reward = "mutation";
4816 switch (chosen_reward ? chosen_reward : effect)
4820 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
4821 chaos_patrons[p_ptr->chaos_patron]);
4823 msg_format("The voice of %s booms out:",
4824 chaos_patrons[p_ptr->chaos_patron]);
4828 msg_print("¡ÖÆò¡¢¿·¤¿¤Ê¤ë»Ñ¤òɬÍפȤ»¤ê¡ª¡×");
4830 msg_print("'Thou needst a new form, mortal!'");
4835 reward = "ÊÑ°Û¤·¤¿¡£";
4837 reward = "polymorphing";
4842 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
4843 chaos_patrons[p_ptr->chaos_patron]);
4845 msg_format("The voice of %s booms out:",
4846 chaos_patrons[p_ptr->chaos_patron]);
4850 msg_print("¡ÖÆò¤ÏÎɤ¯¹Ô¤¤¤¿¤ê¡ªÂ³¤±¤è¡ª¡×");
4852 msg_print("'Well done, mortal! Lead on!'");
4855 if (p_ptr->prace == RACE_ANDROID)
4858 msg_print("¤·¤«¤·²¿¤âµ¯¤³¤é¤Ê¤«¤Ã¤¿¡£");
4860 msg_print("But, nothing happen.");
4863 else if (p_ptr->exp < PY_MAX_EXP)
4865 s32b ee = (p_ptr->exp / 2) + 10;
4866 if (ee > 100000L) ee = 100000L;
4868 msg_print("¹¹¤Ë·Ð¸³¤òÀѤó¤À¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£");
4870 msg_print("You feel more experienced.");
4875 reward = "·Ð¸³ÃͤòÆÀ¤¿";
4877 reward = "experience";
4883 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
4884 chaos_patrons[p_ptr->chaos_patron]);
4886 msg_format("The voice of %s booms out:",
4887 chaos_patrons[p_ptr->chaos_patron]);
4891 msg_print("¡Ö²¼Ëͤ衢Æò¤½¤ì¤ËÃͤ»¤º¡£¡×");
4893 msg_print("'Thou didst not deserve that, slave.'");
4896 if (p_ptr->prace == RACE_ANDROID)
4899 msg_print("¤·¤«¤·²¿¤âµ¯¤³¤é¤Ê¤«¤Ã¤¿¡£");
4901 msg_print("But, nothing happen.");
4906 lose_exp(p_ptr->exp / 6);
4908 reward = "·Ð¸³Ãͤò¼º¤Ã¤¿¡£";
4910 reward = "losing experience";
4916 msg_format("%s¤ÎÀ¼¤¬¤µ¤µ¤ä¤¤¤¿:",
4917 chaos_patrons[p_ptr->chaos_patron]);
4919 msg_format("The voice of %s whispers:",
4920 chaos_patrons[p_ptr->chaos_patron]);
4924 msg_print("¡Ö²æ¤¬Í¿¤¨¤·Êª¤ò¸ÌÀ¤Ë»È¤¦¤Ù¤·¡£¡×");
4926 msg_print("'Use my gift wisely.'");
4929 acquirement(py, px, 1, FALSE, FALSE);
4931 reward = "¾å¼Á¤Ê¥¢¥¤¥Æ¥à¤ò¼ê¤ËÆþ¤ì¤¿¡£";
4933 reward = "a good item";
4938 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
4939 chaos_patrons[p_ptr->chaos_patron]);
4941 msg_format("The voice of %s booms out:",
4942 chaos_patrons[p_ptr->chaos_patron]);
4946 msg_print("¡Ö²æ¤¬Í¿¤¨¤·Êª¤ò¸ÌÀ¤Ë»È¤¦¤Ù¤·¡£¡×");
4948 msg_print("'Use my gift wisely.'");
4951 acquirement(py, px, 1, TRUE, FALSE);
4953 reward = "¹âµéÉʤΥ¢¥¤¥Æ¥à¤ò¼ê¤ËÆþ¤ì¤¿¡£";
4955 reward = "an excellent item";
4960 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
4961 chaos_patrons[p_ptr->chaos_patron]);
4963 msg_format("The voice of %s booms out:",
4964 chaos_patrons[p_ptr->chaos_patron]);
4968 msg_print("¡ÖÆò¤Î¹Ô¤¤¤Ïµ®¤·õ¤ËÃͤ»¤ê¡£¡×");
4970 msg_print("'Thy deed hath earned thee a worthy blade.'");
4973 /* Get local object */
4976 switch (randint1(p_ptr->lev))
4982 dummy2 = SV_MAIN_GAUCHE;
4991 dummy2 = SV_SMALL_SWORD;
4994 dummy2 = SV_BASILLARD;
4996 case 11: case 12: case 13:
4997 dummy2 = SV_SHORT_SWORD;
5003 dummy2 = SV_CUTLASS;
5006 dummy2 = SV_WAKIZASHI;
5009 dummy2 = SV_KHOPESH;
5015 dummy2 = SV_BROAD_SWORD;
5018 dummy2 = SV_LONG_SWORD;
5021 dummy2 = SV_SCIMITAR;
5024 dummy2 = SV_NINJATO;
5030 dummy2 = SV_BASTARD_SWORD;
5033 dummy2 = SV_GREAT_SCIMITAR;
5036 dummy2 = SV_CLAYMORE;
5039 dummy2 = SV_ESPADON;
5042 dummy2 = SV_TWO_HANDED_SWORD;
5045 dummy2 = SV_FLAMBERGE;
5048 dummy2 = SV_NO_DACHI;
5051 dummy2 = SV_EXECUTIONERS_SWORD;
5054 dummy2 = SV_ZWEIHANDER;
5057 dummy2 = SV_HAYABUSA;
5060 dummy2 = SV_BLADE_OF_CHAOS;
5063 object_prep(q_ptr, lookup_kind(dummy, dummy2));
5064 q_ptr->to_h = 3 + randint1(dun_level) % 10;
5065 q_ptr->to_d = 3 + randint1(dun_level) % 10;
5066 one_resistance(q_ptr);
5067 q_ptr->name2 = EGO_CHAOTIC;
5069 /* Drop it in the dungeon */
5070 (void)drop_near(q_ptr, -1, py, px);
5072 reward = "(º®ÆÙ)¤ÎÉð´ï¤ò¼ê¤ËÆþ¤ì¤¿¡£";
5074 reward = "chaos weapon";
5079 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5080 chaos_patrons[p_ptr->chaos_patron]);
5082 msg_format("The voice of %s booms out:",
5083 chaos_patrons[p_ptr->chaos_patron]);
5087 msg_print("¡ÖÆò¤Î¹Ô¤¤¤Ïµ®¤Ê󤤤ËÃͤ»¤ê¡£¡×");
5089 msg_print("'Thy deed hath earned thee a worthy reward.'");
5092 acquirement(py, px, randint1(2) + 1, FALSE, FALSE);
5094 reward = "¾å¼Á¤Ê¥¢¥¤¥Æ¥à¤ò¼ê¤ËÆþ¤ì¤¿¡£";
5096 reward = "good items";
5101 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5102 chaos_patrons[p_ptr->chaos_patron]);
5104 msg_format("The voice of %s booms out:",
5105 chaos_patrons[p_ptr->chaos_patron]);
5109 msg_print("¡Ö²¼Ëͤ衢Æò¤Î¸¥¿È¤Ø¤Î²æ¤¬Àˤ·¤ß̵¤Ê󤤤ò¸«¤ë¤¬¤è¤¤¡£¡×");
5111 msg_print("'Behold, mortal, how generously I reward thy loyalty.'");
5114 acquirement(py, px, randint1(2) + 1, TRUE, FALSE);
5116 reward = "¹âµéÉʤΥ¢¥¤¥Æ¥à¤ò¼ê¤ËÆþ¤ì¤¿¡£";
5118 reward = "excellent items";
5123 msg_format("%s¤ÎÀ¼¤¬¹ì¤ÅϤä¿:",
5124 chaos_patrons[p_ptr->chaos_patron]);
5126 msg_format("The voice of %s thunders:",
5127 chaos_patrons[p_ptr->chaos_patron]);
5131 msg_print("¡Ö²¼Ëͤ衢ÆòÐþËý¤Ê¤ê¡£¡×");
5133 msg_print("'Thou art growing arrogant, mortal.'");
5136 (void)activate_ty_curse(FALSE, &count);
5138 reward = "²Ò¡¹¤·¤¤¼ö¤¤¤ò¤«¤±¤é¤ì¤¿¡£";
5145 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5146 chaos_patrons[p_ptr->chaos_patron]);
5148 msg_format("The voice of %s booms out:",
5149 chaos_patrons[p_ptr->chaos_patron]);
5153 msg_print("¡Ö²æ¤¬²¼Ëͤ¿¤Á¤è¡¢¤«¤ÎÐþËý¤Ê¤ë¼Ô¤òÅݤ¹¤Ù¤·¡ª¡×");
5155 msg_print("'My pets, destroy the arrogant mortal!'");
5158 for (dummy = 0; dummy < randint1(5) + 1; dummy++)
5160 (void)summon_specific(0, py, px, dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
5163 reward = "¥â¥ó¥¹¥¿¡¼¤ò¾¤´¤µ¤ì¤¿¡£";
5165 reward = "summoning hostile monsters";
5170 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5171 chaos_patrons[p_ptr->chaos_patron]);
5173 msg_format("The voice of %s booms out:",
5174 chaos_patrons[p_ptr->chaos_patron]);
5178 msg_print("¡ÖÆò¡¢¤è¤ê¶¯¤Å¨¤òɬÍפȤ»¤ê¡ª¡×");
5180 msg_print("'Thou needst worthier opponents!'");
5183 activate_hi_summon(py, px, FALSE);
5185 reward = "¥â¥ó¥¹¥¿¡¼¤ò¾¤´¤µ¤ì¤¿¡£";
5187 reward = "summoning many hostile monsters";
5192 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5193 chaos_patrons[p_ptr->chaos_patron]);
5195 msg_format("The voice of %s booms out:",
5196 chaos_patrons[p_ptr->chaos_patron]);
5200 msg_print("¡Ö»à¤ÈÇ˲õ¤³¤½²æ¤¬´î¤Ó¤Ê¤ê¡ª¡×");
5202 msg_print("'Death and destruction! This pleaseth me!'");
5207 reward = "¥«¥ª¥¹¤ÎÎϤ¬±²´¬¤¤¤¿¡£";
5209 reward = "calling chaos";
5214 msg_format("%s¤ÎÀ¼¤¬ÌĤê¶Á¤¤¤¿:",
5215 chaos_patrons[p_ptr->chaos_patron]);
5217 msg_format("The voice of %s rings out:",
5218 chaos_patrons[p_ptr->chaos_patron]);
5222 msg_print("¡Öα¤Þ¤ë¤Î¤À¡¢²¼Ëͤ衣;¤¬Æò¤ÎÆùÂΤòÃ䨤󡣡×");
5224 msg_print("'Stay, mortal, and let me mold thee.'");
5227 if (one_in_(3) && !(chaos_stats[p_ptr->chaos_patron] < 0))
5228 do_inc_stat(chaos_stats[p_ptr->chaos_patron]);
5230 do_inc_stat(randint0(6));
5232 reward = "ǽÎÏÃͤ¬¾å¤¬¤Ã¤¿¡£";
5234 reward = "increasing a stat";
5239 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5240 chaos_patrons[p_ptr->chaos_patron]);
5242 msg_format("The voice of %s booms out:",
5243 chaos_patrons[p_ptr->chaos_patron]);
5247 msg_print("¡Ö²¼Ëͤ衢;¤ÏÆò¤ËË°¤ß¤¿¤ê¡£¡×");
5249 msg_print("'I grow tired of thee, mortal.'");
5252 if (one_in_(3) && !(chaos_stats[p_ptr->chaos_patron] < 0))
5253 do_dec_stat(chaos_stats[p_ptr->chaos_patron]);
5255 (void)do_dec_stat(randint0(6));
5257 reward = "ǽÎÏÃͤ¬²¼¤¬¤Ã¤¿¡£";
5259 reward = "decreasing a stat";
5264 msg_format("%s¤ÎÀ¼¤¬¹ì¤ÅϤä¿:",
5265 chaos_patrons[p_ptr->chaos_patron]);
5267 msg_format("The voice of %s thunders:",
5268 chaos_patrons[p_ptr->chaos_patron]);
5272 msg_print("¡ÖÆò¡¢¸¬µõ¤¿¤ë¤³¤È¤ò³Ø¤Ö¤Ù¤·¡ª¡×");
5273 msg_print("¤¢¤Ê¤¿¤Ï°ÊÁ°¤è¤ê¼å¤¯¤Ê¤Ã¤¿¡ª");
5275 msg_print("'Thou needst a lesson in humility, mortal!'");
5276 msg_print("You feel less powerful!");
5279 for (dummy = 0; dummy < 6; dummy++)
5281 (void)dec_stat(dummy, 10 + randint1(15), TRUE);
5284 reward = "Á´Ç½ÎÏÃͤ¬²¼¤¬¤Ã¤¿¡£";
5286 reward = "decreasing all stats";
5291 msg_format("%s¤ÎÎϤ¬¿¨¤ì¤ë¤Î¤ò´¶¤¸¤¿¡£",
5293 msg_format("You feel the power of %s touch you.",
5296 chaos_patrons[p_ptr->chaos_patron]);
5299 reward = "½ý¤¬ÊѲ½¤·¤¿¡£";
5301 reward = "polymorphing wounds";
5306 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5307 chaos_patrons[p_ptr->chaos_patron]);
5309 msg_format("The voice of %s booms out:",
5310 chaos_patrons[p_ptr->chaos_patron]);
5314 msg_print("¡Ö²æ¤¬¤µ¤µ¤ä¤«¤Ê¤ë»òʪ¤ò¼õ¤±¤È¤ë¤¬¤è¤¤¡ª¡×");
5316 msg_print("'Receive this modest gift from me!'");
5319 for (dummy = 0; dummy < 6; dummy++)
5321 (void)do_inc_stat(dummy);
5324 reward = "Á´Ç½ÎÏÃͤ¬¾å¤¬¤Ã¤¿¡£";
5326 reward = "increasing all stats";
5331 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5332 chaos_patrons[p_ptr->chaos_patron]);
5334 msg_format("The voice of %s booms out:",
5335 chaos_patrons[p_ptr->chaos_patron]);
5339 msg_print("¡Ö¶ì¤·¤à¤¬¤è¤¤¡¢ÌµÇ½¤Ê¶ò¤«¼Ô¤è¡ª¡×");
5341 msg_print("'Suffer, pathetic fool!'");
5344 fire_ball(GF_DISINTEGRATE, 0, p_ptr->lev * 4, 4);
5345 take_hit(DAMAGE_NOESCAPE, p_ptr->lev * 4, wrath_reason, -1);
5347 reward = "ʬ²ò¤Îµå¤¬È¯À¸¤·¤¿¡£";
5349 reward = "generating disintegration ball";
5354 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5355 chaos_patrons[p_ptr->chaos_patron]);
5357 msg_format("The voice of %s booms out:",
5358 chaos_patrons[p_ptr->chaos_patron]);
5362 msg_print("¡Öᴤ뤬¤è¤¤¡¢²æ¤¬²¼Ëͤ衪¡×");
5364 msg_print("'Rise, my servant!'");
5368 (void)set_poisoned(0);
5370 (void)set_confused(0);
5375 for (dummy = 0; dummy < 6; dummy++)
5377 (void)do_res_stat(dummy);
5380 reward = "ÂÎÎϤ¬²óÉü¤·¤¿¡£";
5386 if (!buki_motteruka(INVEN_RARM) && !buki_motteruka(INVEN_LARM)) break;
5388 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5389 chaos_patrons[p_ptr->chaos_patron]);
5391 msg_format("The voice of %s booms out:",
5392 chaos_patrons[p_ptr->chaos_patron]);
5396 msg_print("¡ÖÆò¡¢Éð´ï¤ËÍê¤ë¤³¤È¤Ê¤«¤ì¡£¡×");
5398 msg_print("'Thou reliest too much on thy weapon.'");
5402 if (buki_motteruka(INVEN_LARM))
5405 if (buki_motteruka(INVEN_RARM) && one_in_(2)) dummy = INVEN_RARM;
5407 object_desc(o_name, &inventory[dummy], OD_NAME_ONLY);
5408 (void)curse_weapon(FALSE, dummy);
5410 reward = format("%s¤¬Ç˲õ¤µ¤ì¤¿¡£", o_name);
5412 reward = format("destroying %s", o_name);
5416 if (!inventory[INVEN_BODY].k_idx) break;
5418 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5419 chaos_patrons[p_ptr->chaos_patron]);
5421 msg_format("The voice of %s booms out:",
5422 chaos_patrons[p_ptr->chaos_patron]);
5426 msg_print("¡ÖÆò¡¢Ëɶñ¤ËÍê¤ë¤³¤È¤Ê¤«¤ì¡£¡×");
5428 msg_print("'Thou reliest too much on thine equipment.'");
5431 object_desc(o_name, &inventory[INVEN_BODY], OD_NAME_ONLY);
5432 (void)curse_armor();
5434 reward = format("%s¤¬Ç˲õ¤µ¤ì¤¿¡£", o_name);
5436 reward = format("destroying %s", o_name);
5441 msg_format("%s¤ÎÀ¼¤¬¤µ¤µ¤ä¤¤¤¿:",
5442 chaos_patrons[p_ptr->chaos_patron]);
5444 msg_format("The voice of %s whispers:",
5445 chaos_patrons[p_ptr->chaos_patron]);
5449 msg_print("¡Ö²æ¤òÅܤꤷ¤á¤¿ºá¤ò½þ¤¦¤Ù¤·¡£¡×");
5451 msg_print("'Now thou shalt pay for annoying me.'");
5454 switch (randint1(4))
5457 (void)activate_ty_curse(FALSE, &count);
5459 reward = "²Ò¡¹¤·¤¤¼ö¤¤¤ò¤«¤±¤é¤ì¤¿¡£";
5465 activate_hi_summon(py, px, FALSE);
5467 reward = "¥â¥ó¥¹¥¿¡¼¤ò¾¤´¤µ¤ì¤¿¡£";
5469 reward = "summoning hostile monsters";
5475 if (!buki_motteruka(INVEN_RARM) && !buki_motteruka(INVEN_LARM)) break;
5477 if (buki_motteruka(INVEN_LARM))
5480 if (buki_motteruka(INVEN_RARM) && one_in_(2)) dummy = INVEN_RARM;
5482 object_desc(o_name, &inventory[dummy], OD_NAME_ONLY);
5483 (void)curse_weapon(FALSE, dummy);
5485 reward = format("%s¤¬Ç˲õ¤µ¤ì¤¿¡£", o_name);
5487 reward = format("destroying %s", o_name);
5492 if (!inventory[INVEN_BODY].k_idx) break;
5493 object_desc(o_name, &inventory[INVEN_BODY], OD_NAME_ONLY);
5494 (void)curse_armor();
5496 reward = format("%s¤¬Ç˲õ¤µ¤ì¤¿¡£", o_name);
5498 reward = format("destroying %s", o_name);
5503 for (dummy = 0; dummy < 6; dummy++)
5505 (void)dec_stat(dummy, 10 + randint1(15), TRUE);
5508 reward = "Á´Ç½ÎÏÃͤ¬²¼¤¬¤Ã¤¿¡£";
5510 reward = "decreasing all stats";
5517 msg_format("%s¤ÎÀ¼¤¬¹ì¤ÅϤä¿:",
5519 msg_format("The voice of %s thunders:",
5522 chaos_patrons[p_ptr->chaos_patron]);
5524 msg_print("¡Ö»à¤Ì¤¬¤è¤¤¡¢²¼Ëͤ衪¡×");
5526 msg_print("'Die, mortal!'");
5529 take_hit(DAMAGE_LOSELIFE, p_ptr->lev * 4, wrath_reason, -1);
5530 for (dummy = 0; dummy < 6; dummy++)
5532 (void)dec_stat(dummy, 10 + randint1(15), FALSE);
5534 activate_hi_summon(py, px, FALSE);
5535 (void)activate_ty_curse(FALSE, &count);
5540 if (buki_motteruka(INVEN_RARM))
5543 if (buki_motteruka(INVEN_LARM) && one_in_(2)) dummy = INVEN_LARM;
5545 else if (buki_motteruka(INVEN_LARM)) dummy = INVEN_LARM;
5547 if (dummy) (void)curse_weapon(FALSE, dummy);
5549 if (one_in_(2)) (void)curse_armor();
5553 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5554 chaos_patrons[p_ptr->chaos_patron]);
5556 msg_format("The voice of %s booms out:",
5557 chaos_patrons[p_ptr->chaos_patron]);
5561 msg_print("¡Ö»à¤ÈÇ˲õ¤³¤½²æ¤¬´î¤Ó¤Ê¤ê¡ª¡×");
5563 msg_print("'Death and destruction! This pleaseth me!'");
5566 (void)destroy_area(py, px, 25, FALSE);
5568 reward = "¥À¥ó¥¸¥ç¥ó¤¬*Ç˲õ*¤µ¤ì¤¿¡£";
5570 reward = "*destruct*ing dungeon";
5575 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5576 chaos_patrons[p_ptr->chaos_patron]);
5578 msg_format("The voice of %s booms out:",
5579 chaos_patrons[p_ptr->chaos_patron]);
5583 msg_print("¡Ö²æ¡¢Æò¤ÎŨ¤òËõ»¦¤»¤ó¡ª¡×");
5585 msg_print("'Let me relieve thee of thine oppressors!'");
5588 (void)symbol_genocide(0, FALSE);
5590 reward = "¥â¥ó¥¹¥¿¡¼¤¬Ëõ»¦¤µ¤ì¤¿¡£";
5592 reward = "genociding monsters";
5597 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5598 chaos_patrons[p_ptr->chaos_patron]);
5600 msg_format("The voice of %s booms out:",
5601 chaos_patrons[p_ptr->chaos_patron]);
5605 msg_print("¡Ö²æ¡¢Æò¤ÎŨ¤òËõ»¦¤»¤ó¡ª¡×");
5607 msg_print("'Let me relieve thee of thine oppressors!'");
5610 (void)mass_genocide(0, FALSE);
5612 reward = "¥â¥ó¥¹¥¿¡¼¤¬Ëõ»¦¤µ¤ì¤¿¡£";
5614 reward = "genociding nearby monsters";
5619 msg_format("%s¤ÎÎϤ¬Å¨¤ò¹¶·â¤¹¤ë¤Î¤ò´¶¤¸¤¿¡ª",
5620 chaos_patrons[p_ptr->chaos_patron]);
5622 msg_format("You can feel the power of %s assault your enemies!",
5623 chaos_patrons[p_ptr->chaos_patron]);
5626 (void)dispel_monsters(p_ptr->lev * 4);
5630 msg_format("%s¤Ï¤¢¤Ê¤¿¤ò̵»ë¤·¤¿¡£",
5631 chaos_patrons[p_ptr->chaos_patron]);
5633 msg_format("%s ignores you.",
5634 chaos_patrons[p_ptr->chaos_patron]);
5640 msg_format("%s¤ÏË«Èþ¤È¤·¤Æ°Ëâ¤Î»È¤¤¤ò¤è¤³¤·¤¿¡ª",chaos_patrons[p_ptr->chaos_patron]);
5642 msg_format("%s rewards you with a demonic servant!",chaos_patrons[p_ptr->chaos_patron]);
5645 if (!summon_specific(-1, py, px, dun_level, SUMMON_DEMON, PM_FORCE_PET))
5647 msg_print("²¿¤â¸½¤ì¤Ê¤«¤Ã¤¿...");
5649 msg_print("Nobody ever turns up...");
5653 reward = "°Ë⤬¥Ú¥Ã¥È¤Ë¤Ê¤Ã¤¿¡£";
5655 reward = "a demonic servant";
5661 msg_format("%s¤ÏË«Èþ¤È¤·¤Æ»È¤¤¤ò¤è¤³¤·¤¿¡ª",chaos_patrons[p_ptr->chaos_patron]);
5663 msg_format("%s rewards you with a servant!",chaos_patrons[p_ptr->chaos_patron]);
5666 if (!summon_specific(-1, py, px, dun_level, 0, PM_FORCE_PET))
5668 msg_print("²¿¤â¸½¤ì¤Ê¤«¤Ã¤¿...");
5670 msg_print("Nobody ever turns up...");
5674 reward = "¥â¥ó¥¹¥¿¡¼¤¬¥Ú¥Ã¥È¤Ë¤Ê¤Ã¤¿¡£";
5676 reward = "a servant";
5682 msg_format("%s¤ÏË«Èþ¤È¤·¤Æ¥¢¥ó¥Ç¥Ã¥É¤Î»È¤¤¤ò¤è¤³¤·¤¿¡£",chaos_patrons[p_ptr->chaos_patron]);
5684 msg_format("%s rewards you with an undead servant!",chaos_patrons[p_ptr->chaos_patron]);
5687 if (!summon_specific(-1, py, px, dun_level, SUMMON_UNDEAD, PM_FORCE_PET))
5689 msg_print("²¿¤â¸½¤ì¤Ê¤«¤Ã¤¿...");
5691 msg_print("Nobody ever turns up...");
5695 reward = "¥¢¥ó¥Ç¥Ã¥É¤¬¥Ú¥Ã¥È¤Ë¤Ê¤Ã¤¿¡£";
5697 reward = "an undead servant";
5703 msg_format("%s¤ÎÀ¼¤¬¤É¤â¤Ã¤¿:",
5705 msg_format("The voice of %s stammers:",
5708 chaos_patrons[p_ptr->chaos_patron]);
5710 msg_format("¡Ö¤¢¡¼¡¢¤¢¡¼¡¢Åú¤¨¤Ï %d/%d¡£¼ÁÌä¤Ï²¿¡©¡×", type, effect);
5712 msg_format("'Uh... uh... the answer's %d/%d, what's the question?'", type, effect);
5720 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, format("¥Ñ¥È¥í¥ó¤ÎÊó½·¤Ç%s", reward));
5722 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, format("The patron rewards you with %s.", reward));
5729 * XAngband: determine if a given location is "interesting"
5730 * based on target_set_accept function.
5732 static bool tgt_pt_accept(int y, int x)
5737 if (!(in_bounds(y, x))) return (FALSE);
5739 /* Player grid is always interesting */
5740 if ((y == py) && (x == px)) return (TRUE);
5742 /* Handle hallucination */
5743 if (p_ptr->image) return (FALSE);
5745 /* Examine the grid */
5746 c_ptr = &cave[y][x];
5748 /* Interesting memorized features */
5749 if (c_ptr->info & (CAVE_MARK))
5752 if (cave_have_flag_grid(c_ptr, FF_LESS)) return (TRUE);
5753 if (cave_have_flag_grid(c_ptr, FF_MORE)) return (TRUE);
5755 /* Notice quest features */
5756 if (cave_have_flag_grid(c_ptr, FF_QUEST_ENTER)) return (TRUE);
5757 if (cave_have_flag_grid(c_ptr, FF_QUEST_EXIT)) return (TRUE);
5766 * XAngband: Prepare the "temp" array for "tget_pt"
5767 * based on target_set_prepare funciton.
5769 static void tgt_pt_prepare(void)
5773 /* Reset "temp" array */
5776 if (!expand_list) return;
5778 /* Scan the current panel */
5779 for (y = 1; y < cur_hgt; y++)
5781 for (x = 1; x < cur_wid; x++)
5783 /* Require "interesting" contents */
5784 if (!tgt_pt_accept(y, x)) continue;
5786 /* Save the location */
5793 /* Target the nearest monster for shooting */
5794 ang_sort_comp = ang_sort_comp_distance;
5795 ang_sort_swap = ang_sort_swap_distance;
5797 /* Sort the positions */
5798 ang_sort(temp_x, temp_y, temp_n);
5802 * old -- from PsiAngband.
5804 bool tgt_pt(int *x_ptr, int *y_ptr)
5808 bool success = FALSE;
5813 get_screen_size(&wid, &hgt);
5825 msg_print("¾ì½ê¤òÁª¤ó¤Ç¥¹¥Ú¡¼¥¹¥¡¼¤ò²¡¤·¤Æ²¼¤µ¤¤¡£");
5827 msg_print("Select a point and press space.");
5829 msg_flag = FALSE; /* prevents "-more-" message. */
5831 while ((ch != ESCAPE) && !success)
5833 bool move_fast = FALSE;
5835 move_cursor_relative(y, x);
5847 if (player_bold(y, x)) ch = 0;
5850 else success = TRUE;
5854 /* XAngband: Move cursor to stairs */
5857 if (expand_list && temp_n)
5860 int cx = (panel_col_min + panel_col_max) / 2;
5861 int cy = (panel_row_min + panel_row_max) / 2;
5865 /* Skip stairs which have defferent distance */
5866 for (; n < temp_n; ++ n)
5868 cave_type *c_ptr = &cave[temp_y[n]][temp_x[n]];
5870 if (cave_have_flag_grid(c_ptr, FF_STAIRS) &&
5871 cave_have_flag_grid(c_ptr, ch == '>' ? FF_MORE : FF_LESS))
5878 if (n == temp_n) /* Loop out taget list */
5883 verify_panel(); /* Move cursor to player */
5886 p_ptr->update |= (PU_MONSTERS);
5889 p_ptr->redraw |= (PR_MAP);
5892 p_ptr->window |= (PW_OVERHEAD);
5897 else /* move cursor to next stair and change panel */
5902 dy = 2 * (y - cy) / hgt;
5903 dx = 2 * (x - cx) / wid;
5904 if (dy || dx) change_panel(dy, dx);
5910 /* Look up the direction */
5911 d = get_keymap_dir(ch);
5913 /* XTRA HACK MOVEFAST */
5914 if (isupper(ch)) move_fast = TRUE;
5916 /* Handle "direction" */
5922 /* XTRA HACK MOVEFAST */
5925 int mag = MIN(wid / 2, hgt / 2);
5935 /* Do not move horizontally if unnecessary */
5936 if (((x < panel_col_min + wid / 2) && (dx > 0)) ||
5937 ((x > panel_col_min + wid / 2) && (dx < 0)))
5942 /* Do not move vertically if unnecessary */
5943 if (((y < panel_row_min + hgt / 2) && (dy > 0)) ||
5944 ((y > panel_row_min + hgt / 2) && (dy < 0)))
5949 /* Apply the motion */
5950 if ((y >= panel_row_min + hgt) || (y < panel_row_min) ||
5951 (x >= panel_col_min + wid) || (x < panel_col_min))
5953 /* if (change_panel(dy, dx)) target_set_prepare(mode); */
5954 change_panel(dy, dx);
5957 /* Slide into legality */
5958 if (x >= cur_wid-1) x = cur_wid - 2;
5959 else if (x <= 0) x = 1;
5961 /* Slide into legality */
5962 if (y >= cur_hgt-1) y = cur_hgt- 2;
5963 else if (y <= 0) y = 1;
5970 /* Clear the top line */
5973 /* Recenter the map around the player */
5977 p_ptr->update |= (PU_MONSTERS);
5980 p_ptr->redraw |= (PR_MAP);
5983 p_ptr->window |= (PW_OVERHEAD);
5994 bool get_hack_dir(int *dp)
6004 /* Global direction */
6007 /* (No auto-targeting) */
6009 /* Ask until satisfied */
6012 /* Choose a prompt */
6016 p = "Êý¸þ ('*'¤Ç¥¿¡¼¥²¥Ã¥ÈÁªÂò, ESC¤ÇÃæÃÇ)? ";
6018 p = "Direction ('*' to choose a target, Escape to cancel)? ";
6025 p = "Êý¸þ ('5'¤Ç¥¿¡¼¥²¥Ã¥È¤Ø, '*'¤Ç¥¿¡¼¥²¥Ã¥ÈºÆÁªÂò, ESC¤ÇÃæÃÇ)? ";
6027 p = "Direction ('5' for target, '*' to re-target, Escape to cancel)? ";
6032 /* Get a command (or Cancel) */
6033 if (!get_com(p, &command, TRUE)) break;
6037 if (command == '\r') command = 't';
6040 /* Convert various keys to "standard" keys */
6043 /* Use current target */
6054 /* Set new target */
6059 if (target_set(TARGET_KILL)) dir = 5;
6065 /* Look up the direction */
6066 dir = get_keymap_dir(command);
6072 /* Verify requested targets */
6073 if ((dir == 5) && !target_okay()) dir = 0;
6080 if (!dir) return (FALSE);
6082 /* Save the direction */
6085 /* Check for confusion */
6086 if (p_ptr->confused)
6089 /* Random direction */
6090 dir = ddd[randint0(8)];
6093 /* Notice confusion */
6094 if (command_dir != dir)
6098 msg_print("¤¢¤Ê¤¿¤Ïº®Í𤷤Ƥ¤¤ë¡£");
6100 msg_print("You are confused.");
6105 /* Save direction */
6108 /* A "valid" direction was entered */
6114 * ¥¨¥Í¥ë¥®¡¼¤ÎÁý²ÃÎÌ10d5¤ò®¤¯·×»»¤¹¤ë¤¿¤á¤Î´Ø¿ô
6117 #define Go_no_JuuJou 5*5*5*5*5*5*5*5*5*5
6119 s16b gain_energy(void)
6122 s32b energy_result = 10;
6125 tmp = randint0(Go_no_JuuJou);
6127 for (i = 0; i < 9; i ++){
6128 energy_result += tmp % 5;
6132 return (s16b)(energy_result + tmp);
6139 s16b bow_energy(int sval)
6143 /* Analyze the launcher */
6146 /* Sling and ammo */
6153 /* Short Bow and Arrow */
6160 /* Long Bow and Arrow */
6167 /* Bow of irresponsiblity and Arrow */
6174 /* Light Crossbow and Bolt */
6181 /* Heavy Crossbow and Bolt */
6196 int bow_tmul(int sval)
6200 /* Analyze the launcher */
6203 /* Sling and ammo */
6210 /* Short Bow and Arrow */
6217 /* Long Bow and Arrow */
6224 /* Bow of irresponsiblity and Arrow */
6231 /* Light Crossbow and Bolt */
6238 /* Heavy Crossbow and Bolt */
6250 * Return alignment title
6252 cptr your_alignment(void)
6255 if (p_ptr->align > 150) return "ÂçÁ±";
6256 else if (p_ptr->align > 50) return "ÃæÁ±";
6257 else if (p_ptr->align > 10) return "¾®Á±";
6258 else if (p_ptr->align > -11) return "ÃæΩ";
6259 else if (p_ptr->align > -51) return "¾®°";
6260 else if (p_ptr->align > -151) return "Ãæ°";
6263 if (p_ptr->align > 150) return "Lawful";
6264 else if (p_ptr->align > 50) return "Good";
6265 else if (p_ptr->align > 10) return "Neutral Good";
6266 else if (p_ptr->align > -11) return "Neutral";
6267 else if (p_ptr->align > -51) return "Neutral Evil";
6268 else if (p_ptr->align > -151) return "Evil";
6269 else return "Chaotic";
6275 * Return proficiency level of weapons and misc. skills (except riding)
6277 int weapon_exp_level(int weapon_exp)
6279 if (weapon_exp < WEAPON_EXP_BEGINNER) return EXP_LEVEL_UNSKILLED;
6280 else if (weapon_exp < WEAPON_EXP_SKILLED) return EXP_LEVEL_BEGINNER;
6281 else if (weapon_exp < WEAPON_EXP_EXPERT) return EXP_LEVEL_SKILLED;
6282 else if (weapon_exp < WEAPON_EXP_MASTER) return EXP_LEVEL_EXPERT;
6283 else return EXP_LEVEL_MASTER;
6288 * Return proficiency level of riding
6290 int riding_exp_level(int riding_exp)
6292 if (riding_exp < RIDING_EXP_BEGINNER) return EXP_LEVEL_UNSKILLED;
6293 else if (riding_exp < RIDING_EXP_SKILLED) return EXP_LEVEL_BEGINNER;
6294 else if (riding_exp < RIDING_EXP_EXPERT) return EXP_LEVEL_SKILLED;
6295 else if (riding_exp < RIDING_EXP_MASTER) return EXP_LEVEL_EXPERT;
6296 else return EXP_LEVEL_MASTER;
6301 * Return proficiency level of spells
6303 int spell_exp_level(int spell_exp)
6305 if (spell_exp < SPELL_EXP_BEGINNER) return EXP_LEVEL_UNSKILLED;
6306 else if (spell_exp < SPELL_EXP_SKILLED) return EXP_LEVEL_BEGINNER;
6307 else if (spell_exp < SPELL_EXP_EXPERT) return EXP_LEVEL_SKILLED;
6308 else if (spell_exp < SPELL_EXP_MASTER) return EXP_LEVEL_EXPERT;
6309 else return EXP_LEVEL_MASTER;
6314 * Display a rumor and apply its effects
6317 int rumor_num(char *zz, int max_idx)
6319 if (strcmp(zz, "*") == 0) return randint1(max_idx - 1);
6323 cptr rumor_bind_name(char *base, cptr fullname)
6327 s = strstr(base, "{Name}");
6331 v = format("%s%s%s", base, fullname, (s + 6));
6341 void display_rumor(bool ex)
6349 if (randint0(3) == 0) section = 1;
6353 err = get_rnd_line_jonly("rumors_j.txt", section, Rumor, 10);
6354 if (err) strcpy(Rumor, "±³¤Î±½¤â¤¢¤ë¡£");
6356 err = get_rnd_line("rumors.txt", section, Rumor);
6357 if (err) strcpy(Rumor, "Some rumors are wrong.");
6362 if (strncmp(Rumor, "R:", 2) == 0)
6365 cptr rumor_msg = NULL;
6366 cptr rumor_eff_format = NULL;
6367 char fullname[1024] = "";
6369 if (tokenize(Rumor + 2, 3, zz, TOKENIZE_CHECKQUOTE) == 3)
6371 if (strcmp(zz[0], "ARTIFACT") == 0)
6375 object_type *q_ptr = &forge;
6376 artifact_type *a_ptr;
6380 a_idx = rumor_num(zz[1], max_a_idx);
6382 a_ptr = &a_info[a_idx];
6383 if (a_ptr->name) break;
6386 k_idx = lookup_kind(a_ptr->tval, a_ptr->sval);
6387 object_prep(q_ptr, k_idx);
6388 q_ptr->name1 = a_idx;
6389 q_ptr->ident = IDENT_STORE;
6390 object_desc(fullname, q_ptr, OD_NAME_ONLY);
6392 else if (strcmp(zz[0], "MONSTER") == 0)
6395 monster_race *r_ptr;
6399 r_idx = rumor_num(zz[1], max_r_idx);
6400 r_ptr = &r_info[r_idx];
6401 if (r_ptr->name) break;
6404 strcpy(fullname, r_name + r_ptr->name);
6406 /* Remember this monster */
6407 if (!r_ptr->r_sights)
6412 else if (strcmp(zz[0], "DUNGEON") == 0)
6415 dungeon_info_type *d_ptr;
6419 d_idx = rumor_num(zz[1], max_d_idx);
6420 d_ptr = &d_info[d_idx];
6421 if (d_ptr->name) break;
6424 strcpy(fullname, d_name + d_ptr->name);
6426 if (!max_dlv[d_idx])
6428 max_dlv[d_idx] = d_ptr->mindepth;
6429 rumor_eff_format = _("%s¤Ëµ¢´Ô¤Ç¤¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¡£", "You can recall to %s.");
6432 else if (strcmp(zz[0], "TOWN") == 0)
6439 t_idx = rumor_num(zz[1], NO_TOWN);
6440 if (town[t_idx].name) break;
6443 strcpy(fullname, town[t_idx].name);
6445 visit = (1L << (t_idx - 1));
6446 if ((t_idx != SECRET_TOWN) && !(p_ptr->visit & visit))
6448 p_ptr->visit |= visit;
6449 rumor_eff_format = _("%s¤Ë¹Ô¤Ã¤¿¤³¤È¤¬¤¢¤ëµ¤¤¬¤¹¤ë¡£", "You feel you have been to %s.");
6453 rumor_msg = rumor_bind_name(zz[2], fullname);
6454 msg_print(rumor_msg);
6455 if (rumor_eff_format)
6458 msg_format(rumor_eff_format, fullname);
6464 if (err) msg_print("¤³¤Î¾ðÊó¤Ï´Ö°ã¤Ã¤Æ¤¤¤ë¡£");
6466 if (err) msg_print("This information is wrong.");
6471 msg_format("%s", Rumor);