4 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
6 * This software may be copied and distributed for educational, research,
7 * and not for profit purposes provided that this copyright and statement
8 * are included in all such copies. Other copyrights may also apply.
11 /* Purpose: effects of various "objects" */
15 #define REWARD_CHANCE 10
19 * Advance experience levels and print experience
21 void check_experience(void)
23 bool level_reward = FALSE;
24 bool level_mutation = FALSE;
25 bool level_inc_stat = FALSE;
26 bool android = (p_ptr->prace == RACE_ANDROID ? TRUE : FALSE);
27 int old_lev = p_ptr->lev;
29 /* Hack -- lower limit */
30 if (p_ptr->exp < 0) p_ptr->exp = 0;
31 if (p_ptr->max_exp < 0) p_ptr->max_exp = 0;
32 if (p_ptr->max_max_exp < 0) p_ptr->max_max_exp = 0;
34 /* Hack -- upper limit */
35 if (p_ptr->exp > PY_MAX_EXP) p_ptr->exp = PY_MAX_EXP;
36 if (p_ptr->max_exp > PY_MAX_EXP) p_ptr->max_exp = PY_MAX_EXP;
37 if (p_ptr->max_max_exp > PY_MAX_EXP) p_ptr->max_max_exp = PY_MAX_EXP;
39 /* Hack -- maintain "max" experience */
40 if (p_ptr->exp > p_ptr->max_exp) p_ptr->max_exp = p_ptr->exp;
42 /* Hack -- maintain "max max" experience */
43 if (p_ptr->max_exp > p_ptr->max_max_exp) p_ptr->max_max_exp = p_ptr->max_exp;
45 /* Redraw experience */
46 p_ptr->redraw |= (PR_EXP);
52 /* Lose levels while possible */
53 while ((p_ptr->lev > 1) &&
54 (p_ptr->exp < ((android ? player_exp_a : player_exp)[p_ptr->lev - 2] * p_ptr->expfact / 100L)))
59 /* Update some stuff */
60 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
62 /* Redraw some stuff */
63 p_ptr->redraw |= (PR_LEV | PR_TITLE);
66 p_ptr->window |= (PW_PLAYER);
73 /* Gain levels while possible */
74 while ((p_ptr->lev < PY_MAX_LEVEL) &&
75 (p_ptr->exp >= ((android ? player_exp_a : player_exp)[p_ptr->lev-1] * p_ptr->expfact / 100L)))
80 /* Save the highest level */
81 if (p_ptr->lev > p_ptr->max_plv)
83 p_ptr->max_plv = p_ptr->lev;
85 if ((p_ptr->pclass == CLASS_CHAOS_WARRIOR) ||
86 (p_ptr->muta2 & MUT2_CHAOS_GIFT))
90 if (p_ptr->prace == RACE_BEASTMAN)
92 if (one_in_(5)) level_mutation = TRUE;
94 level_inc_stat = TRUE;
96 do_cmd_write_nikki(NIKKI_LEVELUP, p_ptr->lev, NULL);
104 msg_format("¥ì¥Ù¥ë %d ¤Ë¤è¤¦¤³¤½¡£", p_ptr->lev);
106 msg_format("Welcome to level %d.", p_ptr->lev);
110 /* Update some stuff */
111 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
113 /* Redraw some stuff */
114 p_ptr->redraw |= (PR_LEV | PR_TITLE | PR_EXP);
117 p_ptr->window |= (PW_PLAYER | PW_SPELL | PW_INVEN);
119 /* HP¤ÈMP¤Î¾å¾ºÎ̤òɽ¼¨ */
129 if(!(p_ptr->max_plv % 10))
139 cnv_stat(p_ptr->stat_max[0], tmp);
140 prt(format(" a) ÏÓÎÏ (¸½ºßÃÍ %s)", tmp), 2, 14);
141 cnv_stat(p_ptr->stat_max[1], tmp);
142 prt(format(" b) ÃÎǽ (¸½ºßÃÍ %s)", tmp), 3, 14);
143 cnv_stat(p_ptr->stat_max[2], tmp);
144 prt(format(" c) ¸¤µ (¸½ºßÃÍ %s)", tmp), 4, 14);
145 cnv_stat(p_ptr->stat_max[3], tmp);
146 prt(format(" d) ´ïÍÑ (¸½ºßÃÍ %s)", tmp), 5, 14);
147 cnv_stat(p_ptr->stat_max[4], tmp);
148 prt(format(" e) ÂÑµ× (¸½ºßÃÍ %s)", tmp), 6, 14);
149 cnv_stat(p_ptr->stat_max[5], tmp);
150 prt(format(" f) Ì¥ÎÏ (¸½ºßÃÍ %s)", tmp), 7, 14);
152 prt(" ¤É¤ÎǽÎÏÃͤò¾å¤²¤Þ¤¹¤«¡©", 1, 14);
154 cnv_stat(p_ptr->stat_max[0], tmp);
155 prt(format(" a) Str (cur %s)", tmp), 2, 14);
156 cnv_stat(p_ptr->stat_max[1], tmp);
157 prt(format(" b) Int (cur %s)", tmp), 3, 14);
158 cnv_stat(p_ptr->stat_max[2], tmp);
159 prt(format(" c) Wis (cur %s)", tmp), 4, 14);
160 cnv_stat(p_ptr->stat_max[3], tmp);
161 prt(format(" d) Dex (cur %s)", tmp), 5, 14);
162 cnv_stat(p_ptr->stat_max[4], tmp);
163 prt(format(" e) Con (cur %s)", tmp), 6, 14);
164 cnv_stat(p_ptr->stat_max[5], tmp);
165 prt(format(" f) Chr (cur %s)", tmp), 7, 14);
167 prt(" Which stat do you want to raise?", 1, 14);
172 if ((choice >= 'a') && (choice <= 'f')) break;
174 for(n = 0; n < 6; n++)
175 if (n != choice - 'a')
178 if (get_check("¤è¤í¤·¤¤¤Ç¤¹¤«¡©")) break;
180 if (get_check("Are you sure? ")) break;
183 do_inc_stat(choice - 'a');
186 else if(!(p_ptr->max_plv % 2))
187 do_inc_stat(randint0(6));
193 msg_print("¤¢¤Ê¤¿¤ÏÊѤï¤Ã¤¿µ¤¤¬¤¹¤ë...");
195 msg_print("You feel different...");
198 (void)gain_random_mutation(0);
199 level_mutation = FALSE;
203 * Ê󽷤ǥì¥Ù¥ë¤¬¾å¤ë¤ÈºÆµ¢Åª¤Ë check_experience() ¤¬
204 * ¸Æ¤Ð¤ì¤ë¤Î¤Ç½çÈÖ¤òºÇ¸å¤Ë¤¹¤ë¡£
208 gain_level_reward(0);
209 level_reward = FALSE;
212 /* Update some stuff */
213 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
215 /* Redraw some stuff */
216 p_ptr->redraw |= (PR_LEV | PR_TITLE);
219 p_ptr->window |= (PW_PLAYER | PW_SPELL);
225 /* Load an autopick preference file */
226 if (old_lev != p_ptr->lev) autopick_load_pref(FALSE);
231 * Hack -- Return the "automatic coin type" of a monster race
232 * Used to allocate proper treasure when "Creeping coins" die
234 * XXX XXX XXX Note the use of actual "monster names"
236 static int get_coin_type(int r_idx)
238 /* Analyze monsters */
241 case MON_COPPER_COINS: return 2;
242 case MON_SILVER_COINS: return 5;
243 case MON_GOLD_COINS: return 10;
244 case MON_MITHRIL_COINS:
245 case MON_MITHRIL_GOLEM: return 16;
246 case MON_ADAMANT_COINS: return 17;
255 * Hack -- determine if a template is Cloak
257 static bool kind_is_cloak(int k_idx)
259 object_kind *k_ptr = &k_info[k_idx];
261 /* Analyze the item type */
262 if (k_ptr->tval == TV_CLOAK)
267 /* Assume not good */
273 * Hack -- determine if a template is Polearm
275 static bool kind_is_polearm(int k_idx)
277 object_kind *k_ptr = &k_info[k_idx];
279 /* Analyze the item type */
280 if (k_ptr->tval == TV_POLEARM)
285 /* Assume not good */
291 * Hack -- determine if a template is Sword
293 static bool kind_is_sword(int k_idx)
295 object_kind *k_ptr = &k_info[k_idx];
297 /* Analyze the item type */
298 if ((k_ptr->tval == TV_SWORD) && (k_ptr->sval > 2))
303 /* Assume not good */
309 * Hack -- determine if a template is Book
311 static bool kind_is_book(int k_idx)
313 object_kind *k_ptr = &k_info[k_idx];
315 /* Analyze the item type */
316 if ((k_ptr->tval >= TV_LIFE_BOOK) && (k_ptr->tval <= TV_CRUSADE_BOOK))
321 /* Assume not good */
327 * Hack -- determine if a template is Good book
329 static bool kind_is_good_book(int k_idx)
331 object_kind *k_ptr = &k_info[k_idx];
333 /* Analyze the item type */
334 if ((k_ptr->tval >= TV_LIFE_BOOK) && (k_ptr->tval <= TV_CRUSADE_BOOK) && (k_ptr->tval != TV_ARCANE_BOOK) && (k_ptr->sval > 1))
339 /* Assume not good */
345 * Hack -- determine if a template is Armor
347 static bool kind_is_armor(int k_idx)
349 object_kind *k_ptr = &k_info[k_idx];
351 /* Analyze the item type */
352 if (k_ptr->tval == TV_HARD_ARMOR)
357 /* Assume not good */
363 * Hack -- determine if a template is hafted weapon
365 static bool kind_is_hafted(int k_idx)
367 object_kind *k_ptr = &k_info[k_idx];
369 /* Analyze the item type */
370 if (k_ptr->tval == TV_HAFTED)
375 /* Assume not good */
380 void complete_quest(int quest_num)
382 switch (quest[quest_num].type)
384 case QUEST_TYPE_RANDOM:
385 if (record_rand_quest) do_cmd_write_nikki(NIKKI_RAND_QUEST_C, quest_num, NULL);
388 if (record_fix_quest) do_cmd_write_nikki(NIKKI_FIX_QUEST_C, quest_num, NULL);
392 quest[quest_num].status = QUEST_STATUS_COMPLETED;
393 quest[quest_num].complev = (byte)p_ptr->lev;
395 if (!(quest[quest_num].flags & QUEST_FLAG_SILENT))
397 msg_print(_("¥¯¥¨¥¹¥È¤òãÀ®¤·¤¿¡ª", "You just completed your quest!"));
402 static int count_all_hostile_monsters(void)
407 for (x = 0; x < cur_wid; ++ x)
409 for (y = 0; y < cur_hgt; ++ y)
411 int m_idx = cave[y][x].m_idx;
413 if (m_idx > 0 && is_hostile(&m_list[m_idx]))
424 * Check for "Quest" completion when a quest monster is killed or charmed.
426 void check_quest_completion(monster_type *m_ptr)
428 int i, j, y, x, ny, nx;
432 bool create_stairs = FALSE;
438 /* Get the location */
443 quest_num = p_ptr->inside_quest;
445 /* Search for an active quest on this dungeon level */
448 for (i = max_quests - 1; i > 0; i--)
450 /* Quest is not active */
451 if (quest[i].status != QUEST_STATUS_TAKEN)
454 /* Quest is not a dungeon quest */
455 if (quest[i].flags & QUEST_FLAG_PRESET)
458 /* Quest is not on this level */
459 if ((quest[i].level != dun_level) &&
460 (quest[i].type != QUEST_TYPE_KILL_ANY_LEVEL))
463 /* Not a "kill monster" quest */
464 if ((quest[i].type == QUEST_TYPE_FIND_ARTIFACT) ||
465 (quest[i].type == QUEST_TYPE_FIND_EXIT))
468 /* Interesting quest */
469 if ((quest[i].type == QUEST_TYPE_KILL_NUMBER) ||
470 (quest[i].type == QUEST_TYPE_TOWER) ||
471 (quest[i].type == QUEST_TYPE_KILL_ALL))
474 /* Interesting quest */
475 if (((quest[i].type == QUEST_TYPE_KILL_LEVEL) ||
476 (quest[i].type == QUEST_TYPE_KILL_ANY_LEVEL) ||
477 (quest[i].type == QUEST_TYPE_RANDOM)) &&
478 (quest[i].r_idx == m_ptr->r_idx))
485 /* Handle the current quest */
486 if (quest_num && (quest[quest_num].status == QUEST_STATUS_TAKEN))
491 switch (quest[i].type)
493 case QUEST_TYPE_KILL_NUMBER:
497 if (quest[i].cur_num >= quest[i].num_mon)
501 quest[i].cur_num = 0;
505 case QUEST_TYPE_KILL_ALL:
507 if (!is_hostile(m_ptr)) break;
509 if (count_all_hostile_monsters() == 1)
511 if (quest[i].flags & QUEST_FLAG_SILENT)
513 quest[i].status = QUEST_STATUS_FINISHED;
522 case QUEST_TYPE_KILL_LEVEL:
523 case QUEST_TYPE_RANDOM:
525 /* Only count valid monsters */
526 if (quest[i].r_idx != m_ptr->r_idx)
531 if (quest[i].cur_num >= quest[i].max_num)
535 if (!(quest[i].flags & QUEST_FLAG_PRESET))
537 create_stairs = TRUE;
538 p_ptr->inside_quest = 0;
541 /* Finish the two main quests without rewarding */
542 if ((i == QUEST_OBERON) || (i == QUEST_SERPENT))
544 quest[i].status = QUEST_STATUS_FINISHED;
547 if (quest[i].type == QUEST_TYPE_RANDOM)
550 quest[i].status = QUEST_STATUS_FINISHED;
555 case QUEST_TYPE_KILL_ANY_LEVEL:
558 if (quest[i].cur_num >= quest[i].max_num)
561 quest[i].cur_num = 0;
565 case QUEST_TYPE_TOWER:
567 if (!is_hostile(m_ptr)) break;
569 if (count_all_hostile_monsters() == 1)
571 quest[i].status = QUEST_STATUS_STAGE_COMPLETED;
573 if((quest[QUEST_TOWER1].status == QUEST_STATUS_STAGE_COMPLETED) &&
574 (quest[QUEST_TOWER2].status == QUEST_STATUS_STAGE_COMPLETED) &&
575 (quest[QUEST_TOWER3].status == QUEST_STATUS_STAGE_COMPLETED))
578 complete_quest(QUEST_TOWER1);
586 /* Create a magical staircase */
590 while (cave_perma_bold(y, x) || cave[y][x].o_idx || (cave[y][x].info & CAVE_OBJECT) )
592 /* Pick a location */
593 scatter(&ny, &nx, y, x, 1, 0);
599 /* Explain the staircase */
601 msg_print("ËâË¡¤Î³¬Ãʤ¬¸½¤ì¤¿...");
603 msg_print("A magical staircase appears...");
607 /* Create stairs down */
608 cave_set_feat(y, x, feat_down_stair);
610 /* Remember to update everything */
611 p_ptr->update |= (PU_FLOW);
619 for (j = 0; j < (dun_level / 15)+1; j++)
621 /* Get local object */
624 /* Wipe the object */
627 /* Make a great object */
628 make_object(q_ptr, AM_GOOD | AM_GREAT);
630 /* Drop it in the dungeon */
631 (void)drop_near(q_ptr, -1, y, x);
637 void check_find_art_quest_completion(object_type *o_ptr)
640 /* Check if completed a quest */
641 for (i = 0; i < max_quests; i++)
643 if ((quest[i].type == QUEST_TYPE_FIND_ARTIFACT) &&
644 (quest[i].status == QUEST_STATUS_TAKEN) &&
645 (quest[i].k_idx == o_ptr->name1))
653 * Return monster death string
655 cptr extract_note_dies(monster_race *r_ptr)
657 /* Some monsters get "destroyed" */
658 if (!monster_living(r_ptr))
662 for (i = 0; i < 4; i++)
664 if (r_ptr->blow[i].method == RBM_EXPLODE)
667 return "¤ÏÇúȯ¤·¤ÆÊ´¡¹¤Ë¤Ê¤Ã¤¿¡£";
669 return " explodes into tiny shreds.";
677 return " is destroyed.";
681 /* Assume a default death */
691 * Handle the "death" of a monster.
693 * Disperse treasures centered at the monster location based on the
694 * various flags contained in the monster flags fields.
696 * Check for "Quest" completion when a quest monster is killed.
698 * Note that only the player can induce "monster_death()" on Uniques.
699 * Thus (for now) all Quest monsters should be Uniques.
701 * Note that monsters can now carry objects, and when a monster dies,
702 * it drops all of its objects, which may disappear in crowded rooms.
704 void monster_death(int m_idx, bool drop_item)
713 monster_type *m_ptr = &m_list[m_idx];
715 monster_race *r_ptr = &r_info[m_ptr->r_idx];
717 bool visible = ((m_ptr->ml && !p_ptr->image) || (r_ptr->flags1 & RF1_UNIQUE));
721 bool do_gold = (!(r_ptr->flags1 & RF1_ONLY_ITEM));
722 bool do_item = (!(r_ptr->flags1 & RF1_ONLY_GOLD));
723 bool cloned = (m_ptr->smart & SM_CLONED) ? TRUE : FALSE;
724 int force_coin = get_coin_type(m_ptr->r_idx);
729 bool drop_chosen_item = drop_item && !cloned && !p_ptr->inside_arena
730 && !p_ptr->inside_battle && !is_pet(m_ptr);
732 /* The caster is dead? */
733 if (world_monster && world_monster == m_idx) world_monster = 0;
735 /* Notice changes in view */
736 if (r_ptr->flags7 & (RF7_LITE_MASK | RF7_DARK_MASK))
738 /* Update some things */
739 p_ptr->update |= (PU_MON_LITE);
742 /* Get the location */
746 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
750 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
751 do_cmd_write_nikki(NIKKI_NAMED_PET, 3, m_name);
754 /* Let monsters explode! */
755 for (i = 0; i < 4; i++)
757 if (r_ptr->blow[i].method == RBM_EXPLODE)
759 int flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
760 int typ = mbe_info[r_ptr->blow[i].effect].explode_type;
761 int d_dice = r_ptr->blow[i].d_dice;
762 int d_side = r_ptr->blow[i].d_side;
763 int damage = damroll(d_dice, d_side);
765 project(m_idx, 3, y, x, damage, typ, flg, -1);
770 if (m_ptr->mflag2 & MFLAG2_CHAMELEON)
772 choose_new_monster(m_idx, TRUE, MON_CHAMELEON);
773 r_ptr = &r_info[m_ptr->r_idx];
776 /* Check for quest completion */
777 check_quest_completion(m_ptr);
779 /* Handle the possibility of player vanquishing arena combatant -KMW- */
780 if (p_ptr->inside_arena && !is_pet(m_ptr))
782 p_ptr->exit_bldg = TRUE;
784 if (p_ptr->arena_number > MAX_ARENA_MONS)
787 msg_print("ÁÇÀ²¤é¤·¤¤¡ª·¯¤³¤½¿¿¤Î¾¡Íø¼Ô¤À¡£");
789 msg_print("You are a Genuine Champion!");
795 msg_print("¾¡Íø¡ª¥Á¥ã¥ó¥Ô¥ª¥ó¤Ø¤ÎÆ»¤ò¿Ê¤ó¤Ç¤¤¤ë¡£");
797 msg_print("Victorious! You're on your way to becoming Champion.");
801 if (arena_info[p_ptr->arena_number].tval)
803 /* Get local object */
806 /* Prepare to make a prize */
807 object_prep(q_ptr, lookup_kind(arena_info[p_ptr->arena_number].tval, arena_info[p_ptr->arena_number].sval));
809 apply_magic(q_ptr, object_level, AM_NO_FIXED_ART);
811 /* Drop it in the dungeon */
812 (void)drop_near(q_ptr, -1, y, x);
815 if (p_ptr->arena_number > MAX_ARENA_MONS) p_ptr->arena_number++;
816 p_ptr->arena_number++;
821 /* Extract monster name */
822 monster_desc(m_name, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
824 do_cmd_write_nikki(NIKKI_ARENA, p_ptr->arena_number, m_name);
828 if (m_idx == p_ptr->riding)
830 if (rakuba(-1, FALSE))
833 msg_print("ÃÏÌ̤ËÍî¤È¤µ¤ì¤¿¡£");
835 msg_print("You have fallen from your riding pet.");
840 /* Drop a dead corpse? */
841 if (one_in_(r_ptr->flags1 & RF1_UNIQUE ? 1 : 4) &&
842 (r_ptr->flags9 & (RF9_DROP_CORPSE | RF9_DROP_SKELETON)) &&
843 !(p_ptr->inside_arena || p_ptr->inside_battle || cloned || ((m_ptr->r_idx == today_mon) && is_pet(m_ptr))))
845 /* Assume skeleton */
849 * We cannot drop a skeleton? Note, if we are in this check,
850 * we *know* we can drop at least a corpse or a skeleton
852 if (!(r_ptr->flags9 & RF9_DROP_SKELETON))
854 else if ((r_ptr->flags9 & RF9_DROP_CORPSE) && (r_ptr->flags1 & RF1_UNIQUE))
857 /* Else, a corpse is more likely unless we did a "lot" of damage */
858 else if (r_ptr->flags9 & RF9_DROP_CORPSE)
860 /* Lots of damage in one blow */
861 if ((0 - ((m_ptr->maxhp) / 4)) > m_ptr->hp)
863 if (one_in_(5)) corpse = TRUE;
867 if (!one_in_(5)) corpse = TRUE;
871 /* Get local object */
874 /* Prepare to make an object */
875 object_prep(q_ptr, lookup_kind(TV_CORPSE, (corpse ? SV_CORPSE : SV_SKELETON)));
877 apply_magic(q_ptr, object_level, AM_NO_FIXED_ART);
879 q_ptr->pval = m_ptr->r_idx;
881 /* Drop it in the dungeon */
882 (void)drop_near(q_ptr, -1, y, x);
885 /* Drop objects being carried */
886 monster_drop_carried_objects(m_ptr);
888 if (r_ptr->flags1 & RF1_DROP_GOOD) mo_mode |= AM_GOOD;
889 if (r_ptr->flags1 & RF1_DROP_GREAT) mo_mode |= AM_GREAT;
891 switch (m_ptr->r_idx)
893 case MON_PINK_HORROR:
894 /* Pink horrors are replaced with 2 Blue horrors */
895 if (!(p_ptr->inside_arena || p_ptr->inside_battle))
899 for (i = 0; i < 2; i++)
902 bool pet = is_pet(m_ptr);
905 if (pet) mode |= PM_FORCE_PET;
907 if (summon_specific((pet ? -1 : m_idx), wy, wx, 100, SUMMON_BLUE_HORROR, mode))
909 if (player_can_see_bold(wy, wx))
916 msg_print("¥Ô¥ó¥¯¡¦¥Û¥é¡¼¤ÏʬÎö¤·¤¿¡ª");
918 msg_print("The Pink horror divides!");
923 case MON_BLOODLETTER:
924 /* Bloodletters of Khorne may drop a blade of chaos */
925 if (drop_chosen_item && (randint1(100) < 15))
927 /* Get local object */
930 /* Prepare to make a Blade of Chaos */
931 object_prep(q_ptr, lookup_kind(TV_SWORD, SV_BLADE_OF_CHAOS));
933 apply_magic(q_ptr, object_level, AM_NO_FIXED_ART | mo_mode);
935 /* Drop it in the dungeon */
936 (void)drop_near(q_ptr, -1, y, x);
941 if (drop_chosen_item && (dun_level > 9))
943 /* Get local object */
946 /* Wipe the object */
949 /* Activate restriction */
950 if ((dun_level > 49) && one_in_(5))
951 get_obj_num_hook = kind_is_good_book;
953 get_obj_num_hook = kind_is_book;
956 make_object(q_ptr, mo_mode);
958 /* Drop it in the dungeon */
959 (void)drop_near(q_ptr, -1, y, x);
965 * Mega^3-hack: killing a 'Warrior of the Dawn' is likely to
966 * spawn another in the fallen one's place!
968 if (!p_ptr->inside_arena && !p_ptr->inside_battle)
974 bool pet = is_pet(m_ptr);
978 scatter(&wy, &wx, y, x, 20, 0);
980 while (!(in_bounds(wy, wx) && cave_empty_bold2(wy, wx)) && --attempts);
985 if (pet) mode |= PM_FORCE_PET;
987 if (summon_specific((pet ? -1 : m_idx), wy, wx, 100, SUMMON_DAWN, mode))
989 if (player_can_see_bold(wy, wx))
991 msg_print("¿·¤¿¤ÊÀï»Î¤¬¸½¤ì¤¿¡ª");
993 msg_print("A new warrior steps forth!");
1003 /* One more ultra-hack: An Unmaker goes out with a big bang! */
1005 int flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
1006 (void)project(m_idx, 6, y, x, 100, GF_CHAOS, flg, -1);
1010 case MON_UNICORN_ORD:
1013 /* Reward for "lazy" player */
1014 if (p_ptr->pseikaku == SEIKAKU_NAMAKE)
1017 artifact_type *a_ptr = NULL;
1019 if (!drop_chosen_item) break;
1023 switch (randint0(3))
1026 a_idx = ART_NAMAKE_HAMMER;
1029 a_idx = ART_NAMAKE_BOW;
1032 a_idx = ART_NAMAKE_ARMOR;
1036 a_ptr = &a_info[a_idx];
1038 while (a_ptr->cur_num);
1040 /* Create the artifact */
1041 if (create_named_art(a_idx, y, x))
1045 /* Hack -- Memorize location of artifact in saved floors */
1046 if (character_dungeon) a_ptr->floor_id = p_ptr->floor_id;
1048 else if (!preserve_mode) a_ptr->cur_num = 1;
1053 if (!drop_chosen_item) break;
1055 /* Get local object */
1058 /* Mega-Hack -- Prepare to make "Grond" */
1059 object_prep(q_ptr, lookup_kind(TV_HAFTED, SV_GROND));
1061 /* Mega-Hack -- Mark this item as "Grond" */
1062 q_ptr->name1 = ART_GROND;
1064 /* Mega-Hack -- Actually create "Grond" */
1065 apply_magic(q_ptr, -1, AM_GOOD | AM_GREAT);
1067 /* Drop it in the dungeon */
1068 (void)drop_near(q_ptr, -1, y, x);
1070 /* Get local object */
1073 /* Mega-Hack -- Prepare to make "Chaos" */
1074 object_prep(q_ptr, lookup_kind(TV_CROWN, SV_CHAOS));
1076 /* Mega-Hack -- Mark this item as "Chaos" */
1077 q_ptr->name1 = ART_CHAOS;
1079 /* Mega-Hack -- Actually create "Chaos" */
1080 apply_magic(q_ptr, -1, AM_GOOD | AM_GREAT);
1082 /* Drop it in the dungeon */
1083 (void)drop_near(q_ptr, -1, y, x);
1086 case MON_B_DEATH_SWORD:
1087 if (drop_chosen_item)
1089 /* Get local object */
1092 /* Prepare to make a broken sword */
1093 object_prep(q_ptr, lookup_kind(TV_SWORD, randint1(2)));
1095 /* Drop it in the dungeon */
1096 (void)drop_near(q_ptr, -1, y, x);
1102 if (drop_chosen_item && ((m_ptr->r_idx == MON_A_GOLD) ||
1103 ((m_ptr->r_idx == MON_A_SILVER) && (r_ptr->r_akills % 5 == 0))))
1105 /* Get local object */
1108 /* Prepare to make a Can of Toys */
1109 object_prep(q_ptr, lookup_kind(TV_CHEST, SV_CHEST_KANDUME));
1111 apply_magic(q_ptr, object_level, AM_NO_FIXED_ART);
1113 /* Drop it in the dungeon */
1114 (void)drop_near(q_ptr, -1, y, x);
1120 int flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
1121 (void)project(m_idx, 3, y, x, damroll(20, 10), GF_FIRE, flg, -1);
1126 if (!drop_chosen_item) break;
1128 switch (r_ptr->d_char)
1133 /* Get local object */
1136 /* Wipe the object */
1139 /* Activate restriction */
1140 get_obj_num_hook = kind_is_cloak;
1143 make_object(q_ptr, mo_mode);
1145 /* Drop it in the dungeon */
1146 (void)drop_near(q_ptr, -1, y, x);
1153 /* Get local object */
1156 /* Wipe the object */
1159 /* Activate restriction */
1160 get_obj_num_hook = kind_is_polearm;
1162 /* Make a poleweapon */
1163 make_object(q_ptr, mo_mode);
1165 /* Drop it in the dungeon */
1166 (void)drop_near(q_ptr, -1, y, x);
1173 /* Get local object */
1176 /* Wipe the object */
1179 /* Activate restriction */
1180 get_obj_num_hook = kind_is_armor;
1182 /* Make a hard armor */
1183 make_object(q_ptr, mo_mode);
1185 /* Drop it in the dungeon */
1186 (void)drop_near(q_ptr, -1, y, x);
1193 /* Get local object */
1196 /* Wipe the object */
1199 /* Activate restriction */
1200 get_obj_num_hook = kind_is_hafted;
1202 /* Make a hafted weapon */
1203 make_object(q_ptr, mo_mode);
1205 /* Drop it in the dungeon */
1206 (void)drop_near(q_ptr, -1, y, x);
1211 if (m_ptr->r_idx != MON_STORMBRINGER)
1213 /* Get local object */
1216 /* Wipe the object */
1219 /* Activate restriction */
1220 get_obj_num_hook = kind_is_sword;
1223 make_object(q_ptr, mo_mode);
1225 /* Drop it in the dungeon */
1226 (void)drop_near(q_ptr, -1, y, x);
1233 /* Mega-Hack -- drop fixed items */
1234 if (drop_chosen_item)
1239 switch (m_ptr->r_idx)
1259 case MON_STORMBRINGER:
1260 a_idx = ART_STORMBRINGER;
1265 a_idx = ART_CRIMSON;
1275 a_idx = ART_KUSANAGI;
1305 a_idx = ART_WEREWINDLE;
1313 a_idx = ART_GRAYSWANDIR;
1324 a_idx = ART_TWILIGHT;
1329 a_idx = ART_ELENDIL;
1344 a_idx = ART_DESTINY;
1349 a_idx = ART_ZANTETSU;
1364 a_idx = ART_WINBLOWS;
1368 case MON_LUNGORTHIN:
1373 case MON_JACK_SHADOWS:
1379 a_idx = ART_STONEMASK;
1384 a_idx = ART_SOULCRUSH;
1389 a_idx = ART_EXCALIBUR_J;
1394 a_idx = ART_SHUTEN_DOJI;
1399 a_idx = ART_GOTHMOG;
1408 case MON_ROBIN_HOOD:
1409 a_idx = ART_ROBIN_HOOD;
1414 if ((a_idx > 0) && ((randint0(100) < chance) || p_ptr->wizard))
1416 artifact_type *a_ptr = &a_info[a_idx];
1418 if (!a_ptr->cur_num)
1420 /* Create the artifact */
1421 if (create_named_art(a_idx, y, x))
1425 /* Hack -- Memorize location of artifact in saved floors */
1426 if (character_dungeon) a_ptr->floor_id = p_ptr->floor_id;
1428 else if (!preserve_mode) a_ptr->cur_num = 1;
1432 if ((r_ptr->flags7 & RF7_GUARDIAN) && (d_info[dungeon_type].final_guardian == m_ptr->r_idx))
1434 int k_idx = d_info[dungeon_type].final_object ? d_info[dungeon_type].final_object
1435 : lookup_kind(TV_SCROLL, SV_SCROLL_ACQUIREMENT);
1437 if (d_info[dungeon_type].final_artifact)
1439 int a_idx = d_info[dungeon_type].final_artifact;
1440 artifact_type *a_ptr = &a_info[a_idx];
1442 if (!a_ptr->cur_num)
1444 /* Create the artifact */
1445 if (create_named_art(a_idx, y, x))
1449 /* Hack -- Memorize location of artifact in saved floors */
1450 if (character_dungeon) a_ptr->floor_id = p_ptr->floor_id;
1452 else if (!preserve_mode) a_ptr->cur_num = 1;
1454 /* Prevent rewarding both artifact and "default" object */
1455 if (!d_info[dungeon_type].final_object) k_idx = 0;
1461 /* Get local object */
1464 /* Prepare to make a reward */
1465 object_prep(q_ptr, k_idx);
1467 apply_magic(q_ptr, object_level, AM_NO_FIXED_ART | AM_GOOD);
1469 /* Drop it in the dungeon */
1470 (void)drop_near(q_ptr, -1, y, x);
1473 msg_format("¤¢¤Ê¤¿¤Ï%s¤òÀ©ÇƤ·¤¿¡ª",d_name+d_info[dungeon_type].name);
1475 msg_format("You have conquered %s!",d_name+d_info[dungeon_type].name);
1480 /* Determine how much we can drop */
1481 if ((r_ptr->flags1 & RF1_DROP_60) && (randint0(100) < 60)) number++;
1482 if ((r_ptr->flags1 & RF1_DROP_90) && (randint0(100) < 90)) number++;
1483 if (r_ptr->flags1 & RF1_DROP_1D2) number += damroll(1, 2);
1484 if (r_ptr->flags1 & RF1_DROP_2D2) number += damroll(2, 2);
1485 if (r_ptr->flags1 & RF1_DROP_3D2) number += damroll(3, 2);
1486 if (r_ptr->flags1 & RF1_DROP_4D2) number += damroll(4, 2);
1488 if (cloned && !(r_ptr->flags1 & RF1_UNIQUE))
1489 number = 0; /* Clones drop no stuff unless Cloning Pits */
1491 if (is_pet(m_ptr) || p_ptr->inside_battle || p_ptr->inside_arena)
1492 number = 0; /* Pets drop no stuff */
1493 if (!drop_item && (r_ptr->d_char != '$')) number = 0;
1495 if((r_ptr->flags2 & (RF2_MULTIPLY)) && (r_ptr->r_akills > 1024))
1496 number = 0; /* Limit of Multiply monster drop */
1498 /* Hack -- handle creeping coins */
1499 coin_type = force_coin;
1501 /* Average dungeon and monster levels */
1502 object_level = (dun_level + r_ptr->level) / 2;
1504 /* Drop some objects */
1505 for (j = 0; j < number; j++)
1507 /* Get local object */
1510 /* Wipe the object */
1514 if (do_gold && (!do_item || (randint0(100) < 50)))
1516 /* Make some gold */
1517 if (!make_gold(q_ptr)) continue;
1526 /* Make an object */
1527 if (!make_object(q_ptr, mo_mode)) continue;
1533 /* Drop it in the dungeon */
1534 (void)drop_near(q_ptr, -1, y, x);
1537 /* Reset the object level */
1538 object_level = base_level;
1540 /* Reset "coin" type */
1544 /* Take note of any dropped treasure */
1545 if (visible && (dump_item || dump_gold))
1547 /* Take notes on treasure */
1548 lore_treasure(m_idx, dump_item, dump_gold);
1551 /* Only process "Quest Monsters" */
1552 if (!(r_ptr->flags1 & RF1_QUESTOR)) return;
1553 if (p_ptr->inside_battle) return;
1556 if ((m_ptr->r_idx == MON_SERPENT) && !cloned)
1559 p_ptr->total_winner = TRUE;
1561 /* Redraw the "title" */
1562 p_ptr->redraw |= (PR_TITLE);
1565 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "¸«»ö¤ËÊѶòÈÚÅܤξ¡Íø¼Ô¤È¤Ê¤Ã¤¿¡ª");
1567 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "become *WINNER* of Hengband finely!");
1570 if ((p_ptr->pclass == CLASS_CHAOS_WARRIOR) || (p_ptr->muta2 & MUT2_CHAOS_GIFT))
1573 msg_format("%s¤«¤é¤ÎÀ¼¤¬¶Á¤¤¤¿¡£", chaos_patrons[p_ptr->chaos_patron]);
1574 msg_print("¡Ø¤è¤¯¤ä¤Ã¤¿¡¢ÄêÌ¿¤Î¼Ô¤è¡ª¡Ù");
1576 msg_format("The voice of %s booms out:", chaos_patrons[p_ptr->chaos_patron]);
1577 msg_print("'Thou art donst well, mortal!'");
1581 /* Congratulations */
1583 msg_print("*** ¤ª¤á¤Ç¤È¤¦ ***");
1585 msg_print("*** CONGRATULATIONS ***");
1589 msg_print("¤¢¤Ê¤¿¤Ï¥²¡¼¥à¤ò¥³¥ó¥×¥ê¡¼¥È¤·¤Þ¤·¤¿¡£");
1591 msg_print("You have won the game!");
1595 msg_print("½àÈ÷¤¬À°¤Ã¤¿¤é°úÂà(¼«»¦¥³¥Þ¥ó¥É)¤·¤Æ¤â·ë¹½¤Ç¤¹¡£");
1597 msg_print("You may retire (commit suicide) when you are ready.");
1603 * Modify the physical damage done to the monster.
1604 * (for example when it's invulnerable or shielded)
1606 * ToDo: Accept a damage-type to calculate the modified damage from
1607 * things like fire, frost, lightning, poison, ... attacks.
1609 * "type" is not yet used and should be 0.
1611 int mon_damage_mod(monster_type *m_ptr, int dam, bool is_psy_spear)
1613 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1615 if ((r_ptr->flagsr & RFR_RES_ALL) && dam > 0)
1618 if ((dam == 0) && one_in_(3)) dam = 1;
1621 if (MON_INVULNER(m_ptr))
1625 if (!p_ptr->blind && is_seen(m_ptr))
1628 msg_print("¥Ð¥ê¥¢¤òÀÚ¤êÎö¤¤¤¿¡ª");
1630 msg_print("The barrier is penetrated!");
1634 else if (!one_in_(PENETRATE_INVULNERABILITY))
1644 * Calculate experience point to be get
1646 * Even the 64 bit operation is not big enough to avoid overflaw
1647 * unless we carefully choose orders of multiplication and division.
1649 * Get the coefficient first, and multiply (potentially huge) base
1650 * experience point of a monster later.
1652 static void get_exp_from_mon(int dam, monster_type *m_ptr)
1654 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1661 if (!m_ptr->r_idx) return;
1662 if (is_pet(m_ptr) || p_ptr->inside_battle) return;
1665 * - Ratio of monster's level to player's level effects
1666 * - Varying speed effects
1667 * - Get a fraction in proportion of damage point
1669 new_exp = r_ptr->level * SPEED_TO_ENERGY(m_ptr->mspeed) * dam;
1672 div_l = (p_ptr->max_plv+2) * SPEED_TO_ENERGY(r_ptr->speed);
1674 /* Use (average maxhp * 2) as a denominator */
1675 if (!(r_ptr->flags1 & RF1_FORCE_MAXHP))
1676 s64b_mul(&div_h, &div_l, 0, r_ptr->hdice * (ironman_nightmare ? 2 : 1) * (r_ptr->hside + 1));
1678 s64b_mul(&div_h, &div_l, 0, r_ptr->hdice * (ironman_nightmare ? 2 : 1) * r_ptr->hside * 2);
1680 /* Special penalty in the wilderness */
1681 if (!dun_level && (!(r_ptr->flags8 & RF8_WILD_ONLY) || !(r_ptr->flags1 & RF1_UNIQUE)))
1682 s64b_mul(&div_h, &div_l, 0, 5);
1684 /* Do division first to prevent overflaw */
1685 s64b_div(&new_exp, &new_exp_frac, div_h, div_l);
1687 /* Special penalty for mutiply-monster */
1688 if ((r_ptr->flags2 & RF2_MULTIPLY) || (m_ptr->r_idx == MON_DAWN))
1690 int monnum_penarty = r_ptr->r_akills / 400;
1691 if (monnum_penarty > 8) monnum_penarty = 8;
1693 while (monnum_penarty--)
1696 s64b_RSHIFT(new_exp, new_exp_frac, 2);
1700 /* Finally multiply base experience point of the monster */
1701 s64b_mul(&new_exp, &new_exp_frac, 0, r_ptr->mexp);
1703 /* Gain experience */
1704 gain_exp_64(new_exp, new_exp_frac);
1709 * Decreases monsters hit points, handling monster death.
1711 * We return TRUE if the monster has been killed (and deleted).
1713 * We announce monster death (using an optional "death message"
1714 * if given, and a otherwise a generic killed/destroyed message).
1716 * Only "physical attacks" can induce the "You have slain" message.
1717 * Missile and Spell attacks will induce the "dies" message, or
1718 * various "specialized" messages. Note that "You have destroyed"
1719 * and "is destroyed" are synonyms for "You have slain" and "dies".
1721 * Hack -- unseen monsters yield "You have killed it." message.
1723 * Added fear (DGK) and check whether to print fear messages -CWS
1725 * Made name, sex, and capitalization generic -BEN-
1727 * As always, the "ghost" processing is a total hack.
1729 * Hack -- we "delay" fear messages by passing around a "fear" flag.
1731 * XXX XXX XXX Consider decreasing monster experience over time, say,
1732 * by using "(m_exp * m_lev * (m_lev)) / (p_lev * (m_lev + n_killed))"
1733 * instead of simply "(m_exp * m_lev) / (p_lev)", to make the first
1734 * monster worth more than subsequent monsters. This would also need
1735 * to induce changes in the monster recall code.
1737 bool mon_take_hit(int m_idx, int dam, bool *fear, cptr note)
1739 monster_type *m_ptr = &m_list[m_idx];
1740 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1742 monster_type exp_mon;
1744 /* Innocent until proven otherwise */
1745 bool innocent = TRUE, thief = FALSE;
1749 (void)COPY(&exp_mon, m_ptr, monster_type);
1750 if (!(r_ptr->flags7 & RF7_KILL_EXP))
1752 expdam = (m_ptr->hp > dam) ? dam : m_ptr->hp;
1753 if (r_ptr->flags6 & RF6_HEAL) expdam = (expdam+1) * 2 / 3;
1755 get_exp_from_mon(expdam, &exp_mon);
1757 /* Genocided by chaos patron */
1758 if (!m_ptr->r_idx) m_idx = 0;
1761 /* Redraw (later) if needed */
1762 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1763 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
1766 (void)set_monster_csleep(m_idx, 0);
1768 /* Hack - Cancel any special player stealth magics. -LM- */
1769 if (p_ptr->special_defense & NINJA_S_STEALTH)
1771 set_superstealth(FALSE);
1774 /* Genocided by chaos patron */
1775 if (!m_idx) return TRUE;
1780 m_ptr->dealt_damage += dam;
1781 if(m_ptr->dealt_damage > m_ptr->max_maxhp * 100) m_ptr->dealt_damage = m_ptr->max_maxhp * 100;
1784 msg_format( _("¹ç·×%d/%d¤Î¥À¥á¡¼¥¸¤òÍ¿¤¨¤¿¡£","You do %d (out of %d) damage."),
1785 m_ptr->dealt_damage, m_ptr->maxhp);
1788 /* It is dead now */
1793 if (r_info[m_ptr->r_idx].flags7 & RF7_TANUKI)
1795 /* You might have unmasked Tanuki first time */
1796 r_ptr = &r_info[m_ptr->r_idx];
1797 m_ptr->ap_r_idx = m_ptr->r_idx;
1798 if (r_ptr->r_sights < MAX_SHORT) r_ptr->r_sights++;
1801 if (m_ptr->mflag2 & MFLAG2_CHAMELEON)
1803 /* You might have unmasked Chameleon first time */
1804 r_ptr = real_r_ptr(m_ptr);
1805 if (r_ptr->r_sights < MAX_SHORT) r_ptr->r_sights++;
1808 if (!(m_ptr->smart & SM_CLONED))
1810 /* When the player kills a Unique, it stays dead */
1811 if (r_ptr->flags1 & RF1_UNIQUE)
1815 /* Mega-Hack -- Banor & Lupart */
1816 if ((m_ptr->r_idx == MON_BANOR) || (m_ptr->r_idx == MON_LUPART))
1818 r_info[MON_BANORLUPART].max_num = 0;
1819 r_info[MON_BANORLUPART].r_pkills++;
1820 r_info[MON_BANORLUPART].r_akills++;
1821 if (r_info[MON_BANORLUPART].r_tkills < MAX_SHORT) r_info[MON_BANORLUPART].r_tkills++;
1823 else if (m_ptr->r_idx == MON_BANORLUPART)
1825 r_info[MON_BANOR].max_num = 0;
1826 r_info[MON_BANOR].r_pkills++;
1827 r_info[MON_BANOR].r_akills++;
1828 if (r_info[MON_BANOR].r_tkills < MAX_SHORT) r_info[MON_BANOR].r_tkills++;
1829 r_info[MON_LUPART].max_num = 0;
1830 r_info[MON_LUPART].r_pkills++;
1831 r_info[MON_LUPART].r_akills++;
1832 if (r_info[MON_LUPART].r_tkills < MAX_SHORT) r_info[MON_LUPART].r_tkills++;
1836 /* When the player kills a Nazgul, it stays dead */
1837 else if (r_ptr->flags7 & RF7_NAZGUL) r_ptr->max_num--;
1840 /* Count all monsters killed */
1841 if (r_ptr->r_akills < MAX_SHORT) r_ptr->r_akills++;
1843 /* Recall even invisible uniques or winners */
1844 if ((m_ptr->ml && !p_ptr->image) || (r_ptr->flags1 & RF1_UNIQUE))
1846 /* Count kills this life */
1847 if ((m_ptr->mflag2 & MFLAG2_KAGE) && (r_info[MON_KAGE].r_pkills < MAX_SHORT)) r_info[MON_KAGE].r_pkills++;
1848 else if (r_ptr->r_pkills < MAX_SHORT) r_ptr->r_pkills++;
1850 /* Count kills in all lives */
1851 if ((m_ptr->mflag2 & MFLAG2_KAGE) && (r_info[MON_KAGE].r_tkills < MAX_SHORT)) r_info[MON_KAGE].r_tkills++;
1852 else if (r_ptr->r_tkills < MAX_SHORT) r_ptr->r_tkills++;
1854 /* Hack -- Auto-recall */
1855 monster_race_track(m_ptr->ap_r_idx);
1858 /* Extract monster name */
1859 monster_desc(m_name, m_ptr, MD_TRUE_NAME);
1861 /* Don't kill Amberites */
1862 if ((r_ptr->flags3 & RF3_AMBERITE) && one_in_(2))
1864 int curses = 1 + randint1(3);
1865 bool stop_ty = FALSE;
1869 msg_format("%^s¤Ï¶²¤í¤·¤¤·ì¤Î¼ö¤¤¤ò¤¢¤Ê¤¿¤Ë¤«¤±¤¿¡ª", m_name);
1871 msg_format("%^s puts a terrible blood curse on you!", m_name);
1874 curse_equipment(100, 50);
1878 stop_ty = activate_ty_curse(stop_ty, &count);
1883 if (r_ptr->flags2 & RF2_CAN_SPEAK)
1885 char line_got[1024];
1887 /* Dump a message */
1889 if (!get_rnd_line("mondeath_j.txt", m_ptr->r_idx, line_got))
1891 if (!get_rnd_line("mondeath.txt", m_ptr->r_idx, line_got))
1894 msg_format("%^s %s", m_name, line_got);
1897 if (m_ptr->r_idx == MON_SERPENT)
1899 /* Make screen dump */
1900 screen_dump = make_screen_dump();
1905 if (!(d_info[dungeon_type].flags1 & DF1_BEGINNER))
1907 if (!dun_level && !ambush_flag && !p_ptr->inside_arena)
1909 chg_virtue(V_VALOUR, -1);
1911 else if (r_ptr->level > dun_level)
1913 if (randint1(10) <= (r_ptr->level - dun_level))
1914 chg_virtue(V_VALOUR, 1);
1916 if (r_ptr->level > 60)
1918 chg_virtue(V_VALOUR, 1);
1920 if (r_ptr->level >= 2 * (p_ptr->lev+1))
1921 chg_virtue(V_VALOUR, 2);
1924 if (r_ptr->flags1 & RF1_UNIQUE)
1926 if (r_ptr->flags3 & (RF3_EVIL | RF3_GOOD)) chg_virtue(V_HARMONY, 2);
1928 if (r_ptr->flags3 & RF3_GOOD)
1930 chg_virtue(V_UNLIFE, 2);
1931 chg_virtue(V_VITALITY, -2);
1934 if (one_in_(3)) chg_virtue(V_INDIVIDUALISM, -1);
1937 if (m_ptr->r_idx == MON_BEGGAR || m_ptr->r_idx == MON_LEPER)
1939 chg_virtue(V_COMPASSION, -1);
1942 if ((r_ptr->flags3 & RF3_GOOD) &&
1943 ((r_ptr->level) / 10 + (3 * dun_level) >= randint1(100)))
1944 chg_virtue(V_UNLIFE, 1);
1946 if (r_ptr->d_char == 'A')
1948 if (r_ptr->flags1 & RF1_UNIQUE)
1949 chg_virtue(V_FAITH, -2);
1950 else if ((r_ptr->level) / 10 + (3 * dun_level) >= randint1(100))
1952 if (r_ptr->flags3 & RF3_GOOD) chg_virtue(V_FAITH, -1);
1953 else chg_virtue(V_FAITH, 1);
1956 else if (r_ptr->flags3 & RF3_DEMON)
1958 if (r_ptr->flags1 & RF1_UNIQUE)
1959 chg_virtue(V_FAITH, 2);
1960 else if ((r_ptr->level) / 10 + (3 * dun_level) >= randint1(100))
1961 chg_virtue(V_FAITH, 1);
1964 if ((r_ptr->flags3 & RF3_UNDEAD) && (r_ptr->flags1 & RF1_UNIQUE))
1965 chg_virtue(V_VITALITY, 2);
1967 if (r_ptr->r_deaths)
1969 if (r_ptr->flags1 & RF1_UNIQUE)
1971 chg_virtue(V_HONOUR, 10);
1973 else if ((r_ptr->level) / 10 + (2 * dun_level) >= randint1(100))
1975 chg_virtue(V_HONOUR, 1);
1978 if ((r_ptr->flags2 & RF2_MULTIPLY) && (r_ptr->r_akills > 1000) && one_in_(10))
1980 chg_virtue(V_VALOUR, -1);
1983 for (i = 0; i < 4; i++)
1985 if (r_ptr->blow[i].d_dice != 0) innocent = FALSE; /* Murderer! */
1987 if ((r_ptr->blow[i].effect == RBE_EAT_ITEM)
1988 || (r_ptr->blow[i].effect == RBE_EAT_GOLD))
1990 thief = TRUE; /* Thief! */
1993 /* The new law says it is illegal to live in the dungeon */
1994 if (r_ptr->level != 0) innocent = FALSE;
1998 if (r_ptr->flags1 & RF1_UNIQUE)
1999 chg_virtue(V_JUSTICE, 3);
2000 else if (1+((r_ptr->level) / 10 + (2 * dun_level))
2002 chg_virtue(V_JUSTICE, 1);
2006 chg_virtue (V_JUSTICE, -1);
2009 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)))
2011 if (one_in_(4)) chg_virtue(V_NATURE, -1);
2014 if ((r_ptr->flags1 & RF1_UNIQUE) && record_destroy_uniq)
2018 sprintf(note_buf, "%s%s", r_name + r_ptr->name, (m_ptr->smart & SM_CLONED) ? "(¥¯¥í¡¼¥ó)" : "");
2020 sprintf(note_buf, "%s%s", r_name + r_ptr->name, (m_ptr->smart & SM_CLONED) ? "(Clone)" : "");
2022 do_cmd_write_nikki(NIKKI_UNIQUE, 0, note_buf);
2028 /* Death by Missile/Spell attack */
2031 msg_format("%^s%s", m_name, note);
2034 /* Death by physical attack -- invisible monster */
2035 else if (!m_ptr->ml)
2038 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
2039 msg_format("¤»¤Ã¤«¤¯¤À¤«¤é%s¤ò»¦¤·¤¿¡£", m_name);
2041 msg_format("%s¤ò»¦¤·¤¿¡£", m_name);
2043 msg_format("You have killed %s.", m_name);
2048 /* Death by Physical attack -- non-living monster */
2049 else if (!monster_living(r_ptr))
2052 bool explode = FALSE;
2054 for (i = 0; i < 4; i++)
2056 if (r_ptr->blow[i].method == RBM_EXPLODE) explode = TRUE;
2059 /* Special note at death */
2062 msg_format("%s¤ÏÇúȯ¤·¤ÆÊ´¡¹¤Ë¤Ê¤Ã¤¿¡£", m_name);
2064 msg_format("%^s explodes into tiny shreds.", m_name);
2069 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
2070 msg_format("¤»¤Ã¤«¤¯¤À¤«¤é%s¤òÅݤ·¤¿¡£", m_name);
2072 msg_format("%s¤òÅݤ·¤¿¡£", m_name);
2074 msg_format("You have destroyed %s.", m_name);
2079 /* Death by Physical attack -- living monster */
2083 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
2084 msg_format("¤»¤Ã¤«¤¯¤À¤«¤é%s¤òÁò¤êµî¤Ã¤¿¡£", m_name);
2086 msg_format("%s¤òÁò¤êµî¤Ã¤¿¡£", m_name);
2088 msg_format("You have slain %s.", m_name);
2092 if ((r_ptr->flags1 & RF1_UNIQUE) && !(m_ptr->smart & SM_CLONED) && !vanilla_town)
2094 for (i = 0; i < MAX_KUBI; i++)
2096 if ((kubi_r_idx[i] == m_ptr->r_idx) && !(m_ptr->mflag2 & MFLAG2_CHAMELEON))
2099 msg_format("%s¤Î¼ó¤Ë¤Ï¾Þ¶â¤¬¤«¤«¤Ã¤Æ¤¤¤ë¡£", m_name);
2101 msg_format("There is a price on %s's head.", m_name);
2108 /* Generate treasure */
2109 monster_death(m_idx, TRUE);
2111 /* Mega hack : replace IKETA to BIKETAL */
2112 if ((m_ptr->r_idx == MON_IKETA) &&
2113 !(p_ptr->inside_arena || p_ptr->inside_battle))
2115 int dummy_y = m_ptr->fy;
2116 int dummy_x = m_ptr->fx;
2119 if (is_pet(m_ptr)) mode |= PM_FORCE_PET;
2121 /* Delete the monster */
2122 delete_monster_idx(m_idx);
2124 if (summon_named_creature(0, dummy_y, dummy_x, MON_BIKETAL, mode))
2127 msg_print("¡Ö¥Ï¥¡¥Ã¥Ï¥Ã¥Ï¥Ã¥Ï¡ª¡ª»ä¤¬¥Ð¥¤¥±¥¿¥ë¤À¡ª¡ª¡×");
2129 msg_print("Uwa-hahaha! *I* am Biketal!");
2135 /* Delete the monster */
2136 delete_monster_idx(m_idx);
2139 /* Prevent bug of chaos patron's reward */
2140 if (r_ptr->flags7 & RF7_KILL_EXP)
2141 get_exp_from_mon((long)exp_mon.max_maxhp*2, &exp_mon);
2143 get_exp_from_mon(((long)exp_mon.max_maxhp+1L) * 9L / 10L, &exp_mon);
2148 /* Monster is dead */
2155 /* Mega-Hack -- Pain cancels fear */
2156 if (MON_MONFEAR(m_ptr) && (dam > 0))
2159 if (set_monster_monfear(m_idx, MON_MONFEAR(m_ptr) - randint1(dam)))
2166 /* Sometimes a monster gets scared by damage */
2167 if (!MON_MONFEAR(m_ptr) && !(r_ptr->flags3 & (RF3_NO_FEAR)))
2169 /* Percentage of fully healthy */
2170 int percentage = (100L * m_ptr->hp) / m_ptr->maxhp;
2173 * Run (sometimes) if at 10% or less of max hit points,
2174 * or (usually) when hit for half its current hit points
2176 if ((randint1(10) >= percentage) ||
2177 ((dam >= m_ptr->hp) && (randint0(100) < 80)))
2179 /* Hack -- note fear */
2182 /* XXX XXX XXX Hack -- Add some timed fear */
2183 (void)set_monster_monfear(m_idx, (randint1(10) +
2184 (((dam >= m_ptr->hp) && (percentage > 7)) ?
2185 20 : ((11 - percentage) * 5))));
2192 if (p_ptr->riding && (p_ptr->riding == m_idx) && (dam > 0))
2196 /* Extract monster name */
2197 monster_desc(m_name, m_ptr, 0);
2199 if (m_ptr->hp > m_ptr->maxhp/3) dam = (dam + 1) / 2;
2200 if (rakuba((dam > 200) ? 200 : dam, FALSE))
2203 msg_format("%^s¤Ë¿¶¤êÍî¤È¤µ¤ì¤¿¡ª", m_name);
2205 msg_format("%^s has thrown you off!", m_name);
2217 * Get term size and calculate screen size
2219 void get_screen_size(int *wid_p, int *hgt_p)
2221 Term_get_size(wid_p, hgt_p);
2222 *hgt_p -= ROW_MAP + 2;
2223 *wid_p -= COL_MAP + 2;
2224 if (use_bigtile) *wid_p /= 2;
2229 * Calculates current boundaries
2230 * Called below and from "do_cmd_locate()".
2232 void panel_bounds_center(void)
2237 get_screen_size(&wid, &hgt);
2239 panel_row_max = panel_row_min + hgt - 1;
2240 panel_row_prt = panel_row_min - 1;
2241 panel_col_max = panel_col_min + wid - 1;
2242 panel_col_prt = panel_col_min - 13;
2247 * Map resizing whenever the main term changes size
2249 void resize_map(void)
2251 /* Only if the dungeon exists */
2252 if (!character_dungeon) return;
2254 /* Mega-Hack -- no panel yet */
2258 /* Reset the panels */
2259 panel_row_min = cur_hgt;
2260 panel_col_min = cur_wid;
2265 p_ptr->update |= (PU_TORCH | PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
2267 /* Forget lite/view */
2268 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
2270 /* Update lite/view */
2271 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
2273 /* Update monsters */
2274 p_ptr->update |= (PU_MONSTERS);
2276 /* Redraw everything */
2277 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
2279 /* Hack -- update */
2287 * Place the cursor on the player
2289 if (can_save) move_cursor_relative(py, px);
2296 * Redraw a term when it is resized
2298 void redraw_window(void)
2300 /* Only if the dungeon exists */
2301 if (!character_dungeon) return;
2304 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
2307 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
2309 /* Hack -- update */
2318 * Handle a request to change the current panel
2320 * Return TRUE if the panel was changed.
2322 * Also used in do_cmd_locate
2324 bool change_panel(int dy, int dx)
2330 get_screen_size(&wid, &hgt);
2332 /* Apply the motion */
2333 y = panel_row_min + dy * hgt / 2;
2334 x = panel_col_min + dx * wid / 2;
2336 /* Verify the row */
2337 if (y > cur_hgt - hgt) y = cur_hgt - hgt;
2340 /* Verify the col */
2341 if (x > cur_wid - wid) x = cur_wid - wid;
2344 /* Handle "changes" */
2345 if ((y != panel_row_min) || (x != panel_col_min))
2347 /* Save the new panel info */
2351 /* Recalculate the boundaries */
2352 panel_bounds_center();
2355 p_ptr->update |= (PU_MONSTERS);
2358 p_ptr->redraw |= (PR_MAP);
2371 bool change_panel_xy(int y, int x)
2377 get_screen_size(&wid, &hgt);
2379 if (y < panel_row_min) dy = -1;
2380 if (y > panel_row_max) dy = 1;
2381 if (x < panel_col_min) dx = -1;
2382 if (x > panel_col_max) dx = 1;
2384 if (!dy && !dx) return (FALSE);
2386 return change_panel(dy, dx);
2391 * Given an row (y) and col (x), this routine detects when a move
2392 * off the screen has occurred and figures new borders. -RAK-
2394 * "Update" forces a "full update" to take place.
2396 * The map is reprinted if necessary, and "TRUE" is returned.
2398 void verify_panel(void)
2410 get_screen_size(&wid, &hgt);
2412 max_prow_min = cur_hgt - hgt;
2413 max_pcol_min = cur_wid - wid;
2415 /* Bounds checking */
2416 if (max_prow_min < 0) max_prow_min = 0;
2417 if (max_pcol_min < 0) max_pcol_min = 0;
2419 /* Center on player */
2420 if (center_player && (center_running || !running))
2422 /* Center vertically */
2423 prow_min = y - hgt / 2;
2424 if (prow_min < 0) prow_min = 0;
2425 else if (prow_min > max_prow_min) prow_min = max_prow_min;
2427 /* Center horizontally */
2428 pcol_min = x - wid / 2;
2429 if (pcol_min < 0) pcol_min = 0;
2430 else if (pcol_min > max_pcol_min) pcol_min = max_pcol_min;
2434 prow_min = panel_row_min;
2435 pcol_min = panel_col_min;
2437 /* Scroll screen when 2 grids from top/bottom edge */
2438 if (y > panel_row_max - 2)
2440 while (y > prow_min + hgt-1 - 2)
2442 prow_min += (hgt / 2);
2446 if (y < panel_row_min + 2)
2448 while (y < prow_min + 2)
2450 prow_min -= (hgt / 2);
2454 if (prow_min > max_prow_min) prow_min = max_prow_min;
2455 if (prow_min < 0) prow_min = 0;
2457 /* Scroll screen when 4 grids from left/right edge */
2458 if (x > panel_col_max - 4)
2460 while (x > pcol_min + wid-1 - 4)
2462 pcol_min += (wid / 2);
2466 if (x < panel_col_min + 4)
2468 while (x < pcol_min + 4)
2470 pcol_min -= (wid / 2);
2474 if (pcol_min > max_pcol_min) pcol_min = max_pcol_min;
2475 if (pcol_min < 0) pcol_min = 0;
2478 /* Check for "no change" */
2479 if ((prow_min == panel_row_min) && (pcol_min == panel_col_min)) return;
2481 /* Save the new panel info */
2482 panel_row_min = prow_min;
2483 panel_col_min = pcol_min;
2485 /* Hack -- optional disturb on "panel change" */
2486 if (disturb_panel && !center_player) disturb(0, 0);
2488 /* Recalculate the boundaries */
2489 panel_bounds_center();
2492 p_ptr->update |= (PU_MONSTERS);
2495 p_ptr->redraw |= (PR_MAP);
2498 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
2503 * Monster health description
2505 cptr look_mon_desc(monster_type *m_ptr, u32b mode)
2507 monster_race *ap_r_ptr = &r_info[m_ptr->ap_r_idx];
2514 /* Determine if the monster is "living" */
2515 living = monster_living(ap_r_ptr);
2517 /* Calculate a health "percentage" */
2518 perc = 100L * m_ptr->hp / m_ptr->maxhp;
2520 /* Healthy monsters */
2521 if (m_ptr->hp >= m_ptr->maxhp)
2525 desc = living ? "̵½ý" : "̵¥À¥á¡¼¥¸";
2527 desc = living ? "unhurt" : "undamaged";
2532 else if (perc >= 60)
2535 desc = living ? "·Ú½ý" : "¾®¥À¥á¡¼¥¸";
2537 desc = living ? "somewhat wounded" : "somewhat damaged";
2542 else if (perc >= 25)
2545 desc = living ? "Éé½ý" : "Ãæ¥À¥á¡¼¥¸";
2547 desc = living ? "wounded" : "damaged";
2552 else if (perc >= 10)
2555 desc = living ? "½Å½ý" : "Âç¥À¥á¡¼¥¸";
2557 desc = living ? "badly wounded" : "badly damaged";
2565 desc = living ? "Ⱦ»àȾÀ¸" : "Åݤ줫¤±";
2567 desc = living ? "almost dead" : "almost destroyed";
2572 /* Need attitude information? */
2575 /* Full information is not needed */
2578 else if (is_pet(m_ptr))
2581 attitude = ", ¥Ú¥Ã¥È";
2586 else if (is_friendly(m_ptr))
2589 attitude = ", ͧ¹¥Åª";
2591 attitude = ", friendly";
2604 /* Clone monster? */
2605 if (m_ptr->smart & SM_CLONED)
2614 /* Display monster's level --- idea borrowed from ToME */
2615 if (ap_r_ptr->r_tkills && !(m_ptr->mflag2 & MFLAG2_KAGE))
2618 return format("¥ì¥Ù¥ë%d, %s%s%s", ap_r_ptr->level, desc, attitude, clone);
2620 return format("Level %d, %s%s%s", ap_r_ptr->level, desc, attitude, clone);
2626 return format("¥ì¥Ù¥ë???, %s%s%s", desc, attitude, clone);
2628 return format("Level ???, %s%s%s", desc, attitude, clone);
2636 * Angband sorting algorithm -- quick sort in place
2638 * Note that the details of the data we are sorting is hidden,
2639 * and we rely on the "ang_sort_comp()" and "ang_sort_swap()"
2640 * function hooks to interact with the data, which is given as
2641 * two pointers, and which may have any user-defined form.
2643 void ang_sort_aux(vptr u, vptr v, int p, int q)
2661 while (!(*ang_sort_comp)(u, v, b, z)) b--;
2664 while (!(*ang_sort_comp)(u, v, z, a)) a++;
2666 /* Done partition */
2670 (*ang_sort_swap)(u, v, a, b);
2676 /* Recurse left side */
2677 ang_sort_aux(u, v, p, b);
2679 /* Recurse right side */
2680 ang_sort_aux(u, v, b+1, q);
2685 * Angband sorting algorithm -- quick sort in place
2687 * Note that the details of the data we are sorting is hidden,
2688 * and we rely on the "ang_sort_comp()" and "ang_sort_swap()"
2689 * function hooks to interact with the data, which is given as
2690 * two pointers, and which may have any user-defined form.
2692 void ang_sort(vptr u, vptr v, int n)
2694 /* Sort the array */
2695 ang_sort_aux(u, v, 0, n-1);
2700 /*** Targeting Code ***/
2704 * Determine is a monster makes a reasonable target
2706 * The concept of "targeting" was stolen from "Morgul" (?)
2708 * The player can target any location, or any "target-able" monster.
2710 * Currently, a monster is "target_able" if it is visible, and if
2711 * the player can hit it with a projection, and the player is not
2712 * hallucinating. This allows use of "use closest target" macros.
2714 * Future versions may restrict the ability to target "trappers"
2715 * and "mimics", but the semantics is a little bit weird.
2717 bool target_able(int m_idx)
2719 monster_type *m_ptr = &m_list[m_idx];
2721 /* Monster must be alive */
2722 if (!m_ptr->r_idx) return (FALSE);
2724 /* Hack -- no targeting hallucinations */
2725 if (p_ptr->image) return (FALSE);
2727 /* Monster must be visible */
2728 if (!m_ptr->ml) return (FALSE);
2730 if (p_ptr->riding && (p_ptr->riding == m_idx)) return (TRUE);
2732 /* Monster must be projectable */
2733 if (!projectable(py, px, m_ptr->fy, m_ptr->fx)) return (FALSE);
2735 /* XXX XXX XXX Hack -- Never target trappers */
2736 /* if (CLEAR_ATTR && (CLEAR_CHAR)) return (FALSE); */
2746 * Update (if necessary) and verify (if possible) the target.
2748 * We return TRUE if the target is "okay" and FALSE otherwise.
2750 bool target_okay(void)
2752 /* Accept stationary targets */
2753 if (target_who < 0) return (TRUE);
2755 /* Check moving targets */
2758 /* Accept reasonable targets */
2759 if (target_able(target_who))
2761 monster_type *m_ptr = &m_list[target_who];
2763 /* Acquire monster location */
2764 target_row = m_ptr->fy;
2765 target_col = m_ptr->fx;
2772 /* Assume no target */
2778 * Sorting hook -- comp function -- by "distance to player"
2780 * We use "u" and "v" to point to arrays of "x" and "y" positions,
2781 * and sort the arrays by double-distance to the player.
2783 static bool ang_sort_comp_distance(vptr u, vptr v, int a, int b)
2785 byte *x = (byte*)(u);
2786 byte *y = (byte*)(v);
2790 /* Absolute distance components */
2791 kx = x[a]; kx -= px; kx = ABS(kx);
2792 ky = y[a]; ky -= py; ky = ABS(ky);
2794 /* Approximate Double Distance to the first point */
2795 da = ((kx > ky) ? (kx + kx + ky) : (ky + ky + kx));
2797 /* Absolute distance components */
2798 kx = x[b]; kx -= px; kx = ABS(kx);
2799 ky = y[b]; ky -= py; ky = ABS(ky);
2801 /* Approximate Double Distance to the first point */
2802 db = ((kx > ky) ? (kx + kx + ky) : (ky + ky + kx));
2804 /* Compare the distances */
2810 * Sorting hook -- comp function -- by importance level of grids
2812 * We use "u" and "v" to point to arrays of "x" and "y" positions,
2813 * and sort the arrays by level of monster
2815 static bool ang_sort_comp_importance(vptr u, vptr v, int a, int b)
2817 byte *x = (byte*)(u);
2818 byte *y = (byte*)(v);
2819 cave_type *ca_ptr = &cave[y[a]][x[a]];
2820 cave_type *cb_ptr = &cave[y[b]][x[b]];
2821 monster_type *ma_ptr = &m_list[ca_ptr->m_idx];
2822 monster_type *mb_ptr = &m_list[cb_ptr->m_idx];
2823 monster_race *ap_ra_ptr, *ap_rb_ptr;
2825 /* The player grid */
2826 if (y[a] == py && x[a] == px) return TRUE;
2827 if (y[b] == py && x[b] == px) return FALSE;
2829 /* Extract monster race */
2830 if (ca_ptr->m_idx && ma_ptr->ml) ap_ra_ptr = &r_info[ma_ptr->ap_r_idx];
2831 else ap_ra_ptr = NULL;
2832 if (cb_ptr->m_idx && mb_ptr->ml) ap_rb_ptr = &r_info[mb_ptr->ap_r_idx];
2833 else ap_rb_ptr = NULL;
2835 if (ap_ra_ptr && !ap_rb_ptr) return TRUE;
2836 if (!ap_ra_ptr && ap_rb_ptr) return FALSE;
2838 /* Compare two monsters */
2839 if (ap_ra_ptr && ap_rb_ptr)
2841 /* Unique monsters first */
2842 if ((ap_ra_ptr->flags1 & RF1_UNIQUE) && !(ap_rb_ptr->flags1 & RF1_UNIQUE)) return TRUE;
2843 if (!(ap_ra_ptr->flags1 & RF1_UNIQUE) && (ap_rb_ptr->flags1 & RF1_UNIQUE)) return FALSE;
2845 /* Shadowers first (¤¢¤ä¤·¤¤±Æ) */
2846 if ((ma_ptr->mflag2 & MFLAG2_KAGE) && !(mb_ptr->mflag2 & MFLAG2_KAGE)) return TRUE;
2847 if (!(ma_ptr->mflag2 & MFLAG2_KAGE) && (mb_ptr->mflag2 & MFLAG2_KAGE)) return FALSE;
2849 /* Unknown monsters first */
2850 if (!ap_ra_ptr->r_tkills && ap_rb_ptr->r_tkills) return TRUE;
2851 if (ap_ra_ptr->r_tkills && !ap_rb_ptr->r_tkills) return FALSE;
2853 /* Higher level monsters first (if known) */
2854 if (ap_ra_ptr->r_tkills && ap_rb_ptr->r_tkills)
2856 if (ap_ra_ptr->level > ap_rb_ptr->level) return TRUE;
2857 if (ap_ra_ptr->level < ap_rb_ptr->level) return FALSE;
2860 /* Sort by index if all conditions are same */
2861 if (ma_ptr->ap_r_idx > mb_ptr->ap_r_idx) return TRUE;
2862 if (ma_ptr->ap_r_idx < mb_ptr->ap_r_idx) return FALSE;
2865 /* An object get higher priority */
2866 if (cave[y[a]][x[a]].o_idx && !cave[y[b]][x[b]].o_idx) return TRUE;
2867 if (!cave[y[a]][x[a]].o_idx && cave[y[b]][x[b]].o_idx) return FALSE;
2869 /* Priority from the terrain */
2870 if (f_info[ca_ptr->feat].priority > f_info[cb_ptr->feat].priority) return TRUE;
2871 if (f_info[ca_ptr->feat].priority < f_info[cb_ptr->feat].priority) return FALSE;
2873 /* If all conditions are same, compare distance */
2874 return ang_sort_comp_distance(u, v, a, b);
2879 * Sorting hook -- swap function -- by "distance to player"
2881 * We use "u" and "v" to point to arrays of "x" and "y" positions,
2882 * and sort the arrays by distance to the player.
2884 static void ang_sort_swap_distance(vptr u, vptr v, int a, int b)
2886 byte *x = (byte*)(u);
2887 byte *y = (byte*)(v);
2905 * Hack -- help "select" a location (see below)
2907 static s16b target_pick(int y1, int x1, int dy, int dx)
2911 int x2, y2, x3, y3, x4, y4;
2913 int b_i = -1, b_v = 9999;
2916 /* Scan the locations */
2917 for (i = 0; i < temp_n; i++)
2923 /* Directed distance */
2927 /* Verify quadrant */
2928 if (dx && (x3 * dx <= 0)) continue;
2929 if (dy && (y3 * dy <= 0)) continue;
2931 /* Absolute distance */
2935 /* Verify quadrant */
2936 if (dy && !dx && (x4 > y4)) continue;
2937 if (dx && !dy && (y4 > x4)) continue;
2939 /* Approximate Double Distance */
2940 v = ((x4 > y4) ? (x4 + x4 + y4) : (y4 + y4 + x4));
2942 /* XXX XXX XXX Penalize location */
2945 if ((b_i >= 0) && (v >= b_v)) continue;
2957 * Hack -- determine if a given location is "interesting"
2959 static bool target_set_accept(int y, int x)
2963 s16b this_o_idx, next_o_idx = 0;
2966 if (!(in_bounds(y, x))) return (FALSE);
2968 /* Player grid is always interesting */
2969 if (player_bold(y, x)) return (TRUE);
2972 /* Handle hallucination */
2973 if (p_ptr->image) return (FALSE);
2976 /* Examine the grid */
2977 c_ptr = &cave[y][x];
2979 /* Visible monsters */
2982 monster_type *m_ptr = &m_list[c_ptr->m_idx];
2984 /* Visible monsters */
2985 if (m_ptr->ml) return (TRUE);
2988 /* Scan all objects in the grid */
2989 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
2993 /* Acquire object */
2994 o_ptr = &o_list[this_o_idx];
2996 /* Acquire next object */
2997 next_o_idx = o_ptr->next_o_idx;
2999 /* Memorized object */
3000 if (o_ptr->marked & OM_FOUND) return (TRUE);
3003 /* Interesting memorized features */
3004 if (c_ptr->info & (CAVE_MARK))
3006 /* Notice object features */
3007 if (c_ptr->info & CAVE_OBJECT) return (TRUE);
3009 /* Feature code (applying "mimic" field) */
3010 if (have_flag(f_info[get_feat_mimic(c_ptr)].flags, FF_NOTICE)) return TRUE;
3019 * Prepare the "temp" array for "target_set"
3021 * Return the number of target_able monsters in the set.
3023 static void target_set_prepare(int mode)
3026 int min_hgt, max_hgt, min_wid, max_wid;
3028 if (mode & TARGET_KILL)
3031 min_hgt = MAX((py - MAX_RANGE), 0);
3032 max_hgt = MIN((py + MAX_RANGE), cur_hgt - 1);
3033 min_wid = MAX((px - MAX_RANGE), 0);
3034 max_wid = MIN((px + MAX_RANGE), cur_wid - 1);
3036 else /* not targetting */
3039 min_hgt = panel_row_min;
3040 max_hgt = panel_row_max;
3041 min_wid = panel_col_min;
3042 max_wid = panel_col_max;
3045 /* Reset "temp" array */
3048 /* Scan the current panel */
3049 for (y = min_hgt; y <= max_hgt; y++)
3051 for (x = min_wid; x <= max_wid; x++)
3055 /* Require "interesting" contents */
3056 if (!target_set_accept(y, x)) continue;
3058 c_ptr = &cave[y][x];
3060 /* Require target_able monsters for "TARGET_KILL" */
3061 if ((mode & (TARGET_KILL)) && !target_able(c_ptr->m_idx)) continue;
3063 if ((mode & (TARGET_KILL)) && !target_pet && is_pet(&m_list[c_ptr->m_idx])) continue;
3065 /* Save the location */
3072 /* Set the sort hooks */
3073 if (mode & (TARGET_KILL))
3075 /* Target the nearest monster for shooting */
3076 ang_sort_comp = ang_sort_comp_distance;
3077 ang_sort_swap = ang_sort_swap_distance;
3081 /* Look important grids first in Look command */
3082 ang_sort_comp = ang_sort_comp_importance;
3083 ang_sort_swap = ang_sort_swap_distance;
3086 /* Sort the positions */
3087 ang_sort(temp_x, temp_y, temp_n);
3089 if (p_ptr->riding && target_pet && (temp_n > 1) && (mode & (TARGET_KILL)))
3094 temp_y[0] = temp_y[1];
3097 temp_x[0] = temp_x[1];
3101 void target_set_prepare_look(){
3102 target_set_prepare(TARGET_LOOK);
3107 * Evaluate number of kill needed to gain level
3109 static void evaluate_monster_exp(char *buf, monster_type *m_ptr)
3111 monster_race *ap_r_ptr = &r_info[m_ptr->ap_r_idx];
3113 s32b exp_mon, exp_adv;
3114 u32b exp_mon_frac, exp_adv_frac;
3116 if ((p_ptr->lev >= PY_MAX_LEVEL) || (p_ptr->prace == RACE_ANDROID))
3121 else if (!ap_r_ptr->r_tkills || (m_ptr->mflag2 & MFLAG2_KAGE))
3131 /* The monster's experience point (assuming average monster speed) */
3132 exp_mon = ap_r_ptr->mexp * ap_r_ptr->level;
3134 s64b_div(&exp_mon, &exp_mon_frac, 0, (p_ptr->max_plv + 2));
3137 /* Total experience value for next level */
3138 exp_adv = player_exp[p_ptr->lev -1] * p_ptr->expfact;
3140 s64b_div(&exp_adv, &exp_adv_frac, 0, 100);
3142 /* Experience value need to get */
3143 s64b_sub(&exp_adv, &exp_adv_frac, p_ptr->exp, p_ptr->exp_frac);
3146 /* You need to kill at least one monster to get any experience */
3147 s64b_add(&exp_adv, &exp_adv_frac, exp_mon, exp_mon_frac);
3148 s64b_sub(&exp_adv, &exp_adv_frac, 0, 1);
3150 /* Extract number of monsters needed */
3151 s64b_div(&exp_adv, &exp_adv_frac, exp_mon, exp_mon_frac);
3153 /* If 999 or more monsters needed, only display "999". */
3154 num = MIN(999, exp_adv_frac);
3156 /* Display the number */
3157 sprintf(buf,"%03ld", (long int)num);
3161 bool show_gold_on_floor = FALSE;
3164 * Examine a grid, return a keypress.
3166 * The "mode" argument contains the "TARGET_LOOK" bit flag, which
3167 * indicates that the "space" key should scan through the contents
3168 * of the grid, instead of simply returning immediately. This lets
3169 * the "look" command get complete information, without making the
3170 * "target" command annoying.
3172 * The "info" argument contains the "commands" which should be shown
3173 * inside the "[xxx]" text. This string must never be empty, or grids
3174 * containing monsters will be displayed with an extra comma.
3176 * Note that if a monster is in the grid, we update both the monster
3177 * recall info and the health bar info to track that monster.
3179 * Eventually, we may allow multiple objects per grid, or objects
3180 * and terrain features in the same grid. XXX XXX XXX
3182 * This function must handle blindness/hallucination.
3184 static int target_set_aux(int y, int x, int mode, cptr info)
3186 cave_type *c_ptr = &cave[y][x];
3187 s16b this_o_idx, next_o_idx = 0;
3188 cptr s1 = "", s2 = "", s3 = "", x_info = "";
3191 feature_type *f_ptr;
3193 char out_val[MAX_NLEN+80];
3195 #ifdef ALLOW_EASY_FLOOR
3196 int floor_list[23], floor_num = 0;
3198 /* Scan all objects in the grid */
3201 floor_num = scan_floor(floor_list, y, x, 0x02);
3213 #endif /* ALLOW_EASY_FLOOR */
3215 /* Hack -- under the player */
3216 if (player_bold(y, x))
3239 /* Hack -- hallucination */
3243 cptr name = "²¿¤«´ñ̯¤Êʪ";
3245 cptr name = "something strange";
3249 /* Display a message */
3251 sprintf(out_val, "%s%s%s%s [%s]", s1, name, s2, s3, info);
3253 sprintf(out_val, "%s%s%s%s [%s]", s1, s2, s3, name, info);
3257 move_cursor_relative(y, x);
3260 /* Stop on everything but "return" */
3261 if ((query != '\r') && (query != '\n')) return query;
3263 /* Repeat forever */
3268 /* Actual monsters */
3269 if (c_ptr->m_idx && m_list[c_ptr->m_idx].ml)
3271 monster_type *m_ptr = &m_list[c_ptr->m_idx];
3272 monster_race *ap_r_ptr = &r_info[m_ptr->ap_r_idx];
3274 bool recall = FALSE;
3279 /* Get the monster name ("a kobold") */
3280 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
3282 /* Hack -- track this monster race */
3283 monster_race_track(m_ptr->ap_r_idx);
3285 /* Hack -- health bar for this monster */
3286 health_track(c_ptr->m_idx);
3288 /* Hack -- handle stuff */
3302 /* Recall on screen */
3303 screen_roff(m_ptr->ap_r_idx, 0);
3305 /* Hack -- Complete the prompt (again) */
3307 Term_addstr(-1, TERM_WHITE, format(" [r»× %s%s]", x_info, info));
3309 Term_addstr(-1, TERM_WHITE, format(" [r,%s%s]", x_info, info));
3318 /* Normal commands */
3319 if (query != 'r') break;
3324 /* Cleare recall text and repeat */
3330 /* Describe, and prompt for recall */
3331 evaluate_monster_exp(acount, m_ptr);
3334 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);
3336 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);
3342 move_cursor_relative(y, x);
3347 /* Normal commands */
3348 if (query != 'r') break;
3354 /* Always stop at "normal" keys */
3355 if ((query != '\r') && (query != '\n') && (query != ' ') && (query != 'x')) return query;
3357 /* Sometimes stop at "space" key */
3358 if ((query == ' ') && !(mode & (TARGET_LOOK))) return query;
3360 /* Change the intro */
3368 /* Hack -- take account of gender */
3370 if (ap_r_ptr->flags1 & (RF1_FEMALE)) s1 = "Èà½÷¤Ï";
3372 if (ap_r_ptr->flags1 & (RF1_FEMALE)) s1 = "She is ";
3376 else if (ap_r_ptr->flags1 & (RF1_MALE)) s1 = "Èà¤Ï";
3378 else if (ap_r_ptr->flags1 & (RF1_MALE)) s1 = "He is ";
3382 /* Use a preposition */
3391 /* Scan all objects being carried */
3392 for (this_o_idx = m_ptr->hold_o_idx; this_o_idx; this_o_idx = next_o_idx)
3394 char o_name[MAX_NLEN];
3398 /* Acquire object */
3399 o_ptr = &o_list[this_o_idx];
3401 /* Acquire next object */
3402 next_o_idx = o_ptr->next_o_idx;
3404 /* Obtain an object description */
3405 object_desc(o_name, o_ptr, 0);
3407 /* Describe the object */
3409 sprintf(out_val, "%s%s%s%s[%s]", s1, o_name, s2, s3, info);
3411 sprintf(out_val, "%s%s%s%s [%s]", s1, s2, s3, o_name, info);
3415 move_cursor_relative(y, x);
3418 /* Always stop at "normal" keys */
3419 if ((query != '\r') && (query != '\n') && (query != ' ') && (query != 'x')) return query;
3421 /* Sometimes stop at "space" key */
3422 if ((query == ' ') && !(mode & (TARGET_LOOK))) return query;
3424 /* Change the intro */
3428 s2 = "also carrying ";
3432 /* Use a preposition */
3442 #ifdef ALLOW_EASY_FLOOR
3451 char o_name[MAX_NLEN];
3455 /* Acquire object */
3456 o_ptr = &o_list[floor_list[0]];
3458 /* Describe the object */
3459 object_desc(o_name, o_ptr, 0);
3463 sprintf(out_val, "%s%s%s%s[%s]",
3464 s1, o_name, s2, s3, info);
3466 sprintf(out_val, "%s%s%s%s [%s]",
3467 s1, s2, s3, o_name, info);
3471 move_cursor_relative(y, x);
3480 /* Provide one cushion before item listing */
3483 /* Display rough information about items */
3485 sprintf(out_val, "%s %d¸Ä¤Î¥¢¥¤¥Æ¥à%s%s ['x'¤Ç°ìÍ÷, %s]",
3486 s1, floor_num, s2, s3, info);
3488 sprintf(out_val, "%s%s%sa pile of %d items [x,%s]",
3489 s1, s2, s3, floor_num, info);
3493 move_cursor_relative(y, x);
3498 /* No request for listing */
3499 if (query != 'x' && query != ' ') return query;
3503 /** Display list of items **/
3505 /* Continue scrolling list if requested */
3514 show_gold_on_floor = TRUE;
3515 (void)show_floor(0, y, x, &min_width);
3516 show_gold_on_floor = FALSE;
3520 sprintf(out_val, "%s %d¸Ä¤Î¥¢¥¤¥Æ¥à%s%s [Enter¤Ç¼¡¤Ø, %s]",
3521 s1, floor_num, s2, s3, info);
3523 sprintf(out_val, "%s%s%sa pile of %d items [Enter,%s]",
3524 s1, s2, s3, floor_num, info);
3535 /* Exit unless 'Enter' */
3536 if (query != '\n' && query != '\r')
3541 /* Get the object being moved. */
3542 o_idx = c_ptr->o_idx;
3544 /* Only rotate a pile of two or more objects. */
3545 if (!(o_idx && o_list[o_idx].next_o_idx)) continue;
3547 /* Remove the first object from the list. */
3548 excise_object_idx(o_idx);
3550 /* Find end of the list. */
3552 while (o_list[i].next_o_idx)
3553 i = o_list[i].next_o_idx;
3555 /* Add after the last object. */
3556 o_list[i].next_o_idx = o_idx;
3558 /* Loop and re-display the list */
3564 #endif /* ALLOW_EASY_FLOOR */
3567 /* Scan all objects in the grid */
3568 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
3572 /* Acquire object */
3573 o_ptr = &o_list[this_o_idx];
3575 /* Acquire next object */
3576 next_o_idx = o_ptr->next_o_idx;
3579 if (o_ptr->marked & OM_FOUND)
3581 char o_name[MAX_NLEN];
3586 /* Obtain an object description */
3587 object_desc(o_name, o_ptr, 0);
3589 /* Describe the object */
3591 sprintf(out_val, "%s%s%s%s[%s]", s1, o_name, s2, s3, info);
3593 sprintf(out_val, "%s%s%s%s [%s]", s1, s2, s3, o_name, info);
3597 move_cursor_relative(y, x);
3600 /* Always stop at "normal" keys */
3601 if ((query != '\r') && (query != '\n') && (query != ' ') && (query != 'x')) return query;
3603 /* Sometimes stop at "space" key */
3604 if ((query == ' ') && !(mode & TARGET_LOOK)) return query;
3606 /* Change the intro */
3616 if (o_ptr->number != 1) s1 = "¤½¤ì¤é¤Ï";
3618 if (o_ptr->number != 1) s1 = "They are ";
3634 /* Feature code (applying "mimic" field) */
3635 feat = get_feat_mimic(c_ptr);
3637 /* Require knowledge about grid, or ability to see grid */
3638 if (!(c_ptr->info & CAVE_MARK) && !player_can_see_bold(y, x))
3640 /* Forget feature */
3644 f_ptr = &f_info[feat];
3646 /* Terrain feature if needed */
3647 if (boring || have_flag(f_ptr->flags, FF_REMEMBER))
3651 /* Hack -- special handling for quest entrances */
3652 if (have_flag(f_ptr->flags, FF_QUEST_ENTER))
3654 /* Set the quest number temporary */
3655 int old_quest = p_ptr->inside_quest;
3658 /* Clear the text */
3659 for (j = 0; j < 10; j++) quest_text[j][0] = '\0';
3660 quest_text_line = 0;
3662 p_ptr->inside_quest = c_ptr->special;
3664 /* Get the quest text */
3665 init_flags = INIT_NAME_ONLY;
3667 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
3670 name = format("¥¯¥¨¥¹¥È¡Ö%s¡×(%d³¬ÁêÅö)", quest[c_ptr->special].name, quest[c_ptr->special].level);
3672 name = format("the entrance to the quest '%s'(level %d)", quest[c_ptr->special].name, quest[c_ptr->special].level);
3675 /* Reset the old quest number */
3676 p_ptr->inside_quest = old_quest;
3679 /* Hack -- special handling for building doors */
3680 else if (have_flag(f_ptr->flags, FF_BLDG) && !p_ptr->inside_arena)
3682 name = building[f_ptr->subtype].name;
3684 else if (have_flag(f_ptr->flags, FF_ENTRANCE))
3687 name = format("%s(%d³¬ÁêÅö)", d_text + d_info[c_ptr->special].text, d_info[c_ptr->special].mindepth);
3689 name = format("%s(level %d)", d_text + d_info[c_ptr->special].text, d_info[c_ptr->special].mindepth);
3692 else if (have_flag(f_ptr->flags, FF_TOWN))
3694 name = town[c_ptr->special].name;
3696 else if (p_ptr->wild_mode && (feat == feat_floor))
3706 name = f_name + f_ptr->name;
3712 ((!have_flag(f_ptr->flags, FF_MOVE) && !have_flag(f_ptr->flags, FF_CAN_FLY)) ||
3713 (!have_flag(f_ptr->flags, FF_LOS) && !have_flag(f_ptr->flags, FF_TREE)) ||
3714 have_flag(f_ptr->flags, FF_TOWN)))
3723 /* Hack -- special introduction for store & building doors -KMW- */
3724 if (have_flag(f_ptr->flags, FF_STORE) ||
3725 have_flag(f_ptr->flags, FF_QUEST_ENTER) ||
3726 (have_flag(f_ptr->flags, FF_BLDG) && !p_ptr->inside_arena) ||
3727 have_flag(f_ptr->flags, FF_ENTRANCE))
3736 else if (have_flag(f_ptr->flags, FF_FLOOR) ||
3737 have_flag(f_ptr->flags, FF_TOWN) ||
3738 have_flag(f_ptr->flags, FF_SHALLOW) ||
3739 have_flag(f_ptr->flags, FF_DEEP))
3745 /* Pick proper indefinite article */
3746 s3 = (is_a_vowel(name[0])) ? "an " : "a ";
3750 /* Display a message */
3754 if (c_ptr->mimic) sprintf(f_idx_str, "%d/%d", c_ptr->feat, c_ptr->mimic);
3755 else sprintf(f_idx_str, "%d", c_ptr->feat);
3757 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]);
3759 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);
3764 sprintf(out_val, "%s%s%s%s[%s]", s1, name, s2, s3, info);
3766 sprintf(out_val, "%s%s%s%s [%s]", s1, s2, s3, name, info);
3770 move_cursor_relative(y, x);
3773 /* Always stop at "normal" keys */
3774 if ((query != '\r') && (query != '\n') && (query != ' ')) return query;
3777 /* Stop on everything but "return" */
3778 if ((query != '\r') && (query != '\n')) return query;
3780 /* Repeat forever */
3786 * Handle "target" and "look".
3788 * Note that this code can be called from "get_aim_dir()".
3790 * All locations must be on the current panel. Consider the use of
3791 * "panel_bounds()" to allow "off-panel" targets, perhaps by using
3792 * some form of "scrolling" the map around the cursor. XXX XXX XXX
3793 * That is, consider the possibility of "auto-scrolling" the screen
3794 * while the cursor moves around. This may require changes in the
3795 * "update_mon()" code to allow "visibility" even if off panel, and
3796 * may require dynamic recalculation of the "temp" grid set.
3798 * Hack -- targeting/observing an "outer border grid" may induce
3799 * problems, so this is not currently allowed.
3801 * The player can use the direction keys to move among "interesting"
3802 * grids in a heuristic manner, or the "space", "+", and "-" keys to
3803 * move through the "interesting" grids in a sequential manner, or
3804 * can enter "location" mode, and use the direction keys to move one
3805 * grid at a time in any direction. The "t" (set target) command will
3806 * only target a monster (as opposed to a location) if the monster is
3807 * target_able and the "interesting" mode is being used.
3809 * The current grid is described using the "look" method above, and
3810 * a new command may be entered at any time, but note that if the
3811 * "TARGET_LOOK" bit flag is set (or if we are in "location" mode,
3812 * where "space" has no obvious meaning) then "space" will scan
3813 * through the description of the current grid until done, instead
3814 * of immediately jumping to the next "interesting" grid. This
3815 * allows the "target" command to retain its old semantics.
3817 * The "*", "+", and "-" keys may always be used to jump immediately
3818 * to the next (or previous) interesting grid, in the proper mode.
3820 * The "return" key may always be used to scan through a complete
3821 * grid description (forever).
3823 * This command will cancel any old target, even if used from
3824 * inside the "look" command.
3826 bool target_set(int mode)
3845 get_screen_size(&wid, &hgt);
3851 /* Cancel tracking */
3852 /* health_track(0); */
3855 /* Prepare the "temp" array */
3856 target_set_prepare(mode);
3858 /* Start near the player */
3864 /* Interesting grids */
3871 change_panel_xy(y, x);
3873 if (!(mode & TARGET_LOOK)) prt_path(y, x);
3876 c_ptr = &cave[y][x];
3879 if (target_able(c_ptr->m_idx))
3882 strcpy(info, "q»ß t·è p¼« o¸½ +¼¡ -Á°");
3884 strcpy(info, "q,t,p,o,+,-,<dir>");
3889 /* Dis-allow target */
3893 strcpy(info, "q»ß p¼« o¸½ +¼¡ -Á°");
3895 strcpy(info, "q,p,o,+,-,<dir>");
3900 /* Describe and Prompt */
3902 query = target_set_aux(y, x, mode, info);
3906 /* Cancel tracking */
3907 /* health_track(0); */
3909 /* Assume no "direction" */
3914 if (query == '\r') query = 't';
3932 if (target_able(c_ptr->m_idx))
3934 health_track(c_ptr->m_idx);
3935 target_who = c_ptr->m_idx;
3954 if (!expand_list) done = TRUE;
3964 if (!expand_list) done = TRUE;
3971 /* Recenter the map around the player */
3975 p_ptr->update |= (PU_MONSTERS);
3978 p_ptr->redraw |= (PR_MAP);
3981 p_ptr->window |= (PW_OVERHEAD);
3986 /* Recalculate interesting grids */
3987 target_set_prepare(mode);
4006 /* Extract the action (if any) */
4007 d = get_keymap_dir(query);
4014 /* Hack -- move around */
4017 /* Modified to scroll to monster */
4018 int y2 = panel_row_min;
4019 int x2 = panel_col_min;
4021 /* Find a new monster */
4022 i = target_pick(temp_y[m], temp_x[m], ddy[d], ddx[d]);
4024 /* Request to target past last interesting grid */
4025 while (flag && (i < 0))
4027 /* Note the change */
4028 if (change_panel(ddy[d], ddx[d]))
4033 /* Recalculate interesting grids */
4034 target_set_prepare(mode);
4036 /* Look at interesting grids */
4039 /* Find a new monster */
4040 i = target_pick(v, u, ddy[d], ddx[d]);
4046 /* Nothing interesting */
4052 /* Restore previous position */
4055 panel_bounds_center();
4058 p_ptr->update |= (PU_MONSTERS);
4061 p_ptr->redraw |= (PR_MAP);
4064 p_ptr->window |= (PW_OVERHEAD);
4069 /* Recalculate interesting grids */
4070 target_set_prepare(mode);
4072 /* Look at boring grids */
4079 /* Do not move horizontally if unnecessary */
4080 if (((x < panel_col_min + wid / 2) && (dx > 0)) ||
4081 ((x > panel_col_min + wid / 2) && (dx < 0)))
4086 /* Do not move vertically if unnecessary */
4087 if (((y < panel_row_min + hgt / 2) && (dy > 0)) ||
4088 ((y > panel_row_min + hgt / 2) && (dy < 0)))
4093 /* Apply the motion */
4094 if ((y >= panel_row_min+hgt) || (y < panel_row_min) ||
4095 (x >= panel_col_min+wid) || (x < panel_col_min))
4097 if (change_panel(dy, dx)) target_set_prepare(mode);
4100 /* Slide into legality */
4101 if (x >= cur_wid-1) x = cur_wid - 2;
4102 else if (x <= 0) x = 1;
4104 /* Slide into legality */
4105 if (y >= cur_hgt-1) y = cur_hgt- 2;
4106 else if (y <= 0) y = 1;
4115 /* Arbitrary grids */
4118 bool move_fast = FALSE;
4120 if (!(mode & TARGET_LOOK)) prt_path(y, x);
4123 c_ptr = &cave[y][x];
4125 /* Default prompt */
4127 strcpy(info, "q»ß t·è p¼« m¶á +¼¡ -Á°");
4129 strcpy(info, "q,t,p,m,+,-,<dir>");
4133 /* Describe and Prompt (enable "TARGET_LOOK") */
4134 while (!(query = target_set_aux(y, x, mode | TARGET_LOOK, info)));
4136 /* Cancel tracking */
4137 /* health_track(0); */
4139 /* Assume no direction */
4144 if (query == '\r') query = 't';
4147 /* Analyze the keypress */
4171 /* Recenter the map around the player */
4175 p_ptr->update |= (PU_MONSTERS);
4178 p_ptr->redraw |= (PR_MAP);
4181 p_ptr->window |= (PW_OVERHEAD);
4186 /* Recalculate interesting grids */
4187 target_set_prepare(mode);
4209 /* Pick a nearby monster */
4210 for (i = 0; i < temp_n; i++)
4212 t = distance(y, x, temp_y[i], temp_x[i]);
4222 /* Nothing interesting */
4223 if (bd == 999) flag = FALSE;
4230 /* Extract the action (if any) */
4231 d = get_keymap_dir(query);
4233 /* XTRA HACK MOVEFAST */
4234 if (isupper(query)) move_fast = TRUE;
4241 /* Handle "direction" */
4247 /* XTRA HACK MOVEFAST */
4250 int mag = MIN(wid / 2, hgt / 2);
4260 /* Do not move horizontally if unnecessary */
4261 if (((x < panel_col_min + wid / 2) && (dx > 0)) ||
4262 ((x > panel_col_min + wid / 2) && (dx < 0)))
4267 /* Do not move vertically if unnecessary */
4268 if (((y < panel_row_min + hgt / 2) && (dy > 0)) ||
4269 ((y > panel_row_min + hgt / 2) && (dy < 0)))
4274 /* Apply the motion */
4275 if ((y >= panel_row_min + hgt) || (y < panel_row_min) ||
4276 (x >= panel_col_min + wid) || (x < panel_col_min))
4278 if (change_panel(dy, dx)) target_set_prepare(mode);
4281 /* Slide into legality */
4282 if (x >= cur_wid-1) x = cur_wid - 2;
4283 else if (x <= 0) x = 1;
4285 /* Slide into legality */
4286 if (y >= cur_hgt-1) y = cur_hgt- 2;
4287 else if (y <= 0) y = 1;
4295 /* Clear the top line */
4298 /* Recenter the map around the player */
4302 p_ptr->update |= (PU_MONSTERS);
4305 p_ptr->redraw |= (PR_MAP);
4308 p_ptr->window |= (PW_OVERHEAD);
4313 /* Failure to set target */
4314 if (!target_who) return (FALSE);
4322 * Get an "aiming direction" from the user.
4324 * The "dir" is loaded with 1,2,3,4,6,7,8,9 for "actual direction", and
4325 * "0" for "current target", and "-1" for "entry aborted".
4327 * Note that "Force Target", if set, will pre-empt user interaction,
4328 * if there is a usable target already set.
4330 * Note that confusion over-rides any (explicit?) user choice.
4332 bool get_aim_dir(int *dp)
4343 /* Global direction */
4346 /* Hack -- auto-target if requested */
4347 if (use_old_target && target_okay()) dir = 5;
4349 #ifdef ALLOW_REPEAT /* TNB */
4351 if (repeat_pull(dp))
4356 if (!(*dp == 5 && !target_okay()))
4358 /* return (TRUE); */
4363 #endif /* ALLOW_REPEAT -- TNB */
4365 /* Ask until satisfied */
4368 /* Choose a prompt */
4372 p = "Êý¸þ ('*'¤Ç¥¿¡¼¥²¥Ã¥ÈÁªÂò, ESC¤ÇÃæÃÇ)? ";
4374 p = "Direction ('*' to choose a target, Escape to cancel)? ";
4381 p = "Êý¸þ ('5'¤Ç¥¿¡¼¥²¥Ã¥È¤Ø, '*'¤Ç¥¿¡¼¥²¥Ã¥ÈºÆÁªÂò, ESC¤ÇÃæÃÇ)? ";
4383 p = "Direction ('5' for target, '*' to re-target, Escape to cancel)? ";
4388 /* Get a command (or Cancel) */
4389 if (!get_com(p, &command, TRUE)) break;
4393 if (command == '\r') command = 't';
4396 /* Convert various keys to "standard" keys */
4399 /* Use current target */
4410 /* Set new target */
4415 if (target_set(TARGET_KILL)) dir = 5;
4421 /* Extract the action (if any) */
4422 dir = get_keymap_dir(command);
4428 /* Verify requested targets */
4429 if ((dir == 5) && !target_okay()) dir = 0;
4438 project_length = 0; /* reset to default */
4442 /* Save the direction */
4445 /* Check for confusion */
4446 if (p_ptr->confused)
4449 /* Random direction */
4450 dir = ddd[randint0(8)];
4453 /* Notice confusion */
4454 if (command_dir != dir)
4458 msg_print("¤¢¤Ê¤¿¤Ïº®Í𤷤Ƥ¤¤ë¡£");
4460 msg_print("You are confused.");
4465 /* Save direction */
4468 #ifdef ALLOW_REPEAT /* TNB */
4470 /* repeat_push(dir); */
4471 repeat_push(command_dir);
4473 #endif /* ALLOW_REPEAT -- TNB */
4475 /* A "valid" direction was entered */
4482 * Request a "movement" direction (1,2,3,4,6,7,8,9) from the user,
4483 * and place it into "command_dir", unless we already have one.
4485 * This function should be used for all "repeatable" commands, such as
4486 * run, walk, open, close, bash, disarm, spike, tunnel, etc, as well
4487 * as all commands which must reference a grid adjacent to the player,
4488 * and which may not reference the grid under the player. Note that,
4489 * for example, it is no longer possible to "disarm" or "open" chests
4490 * in the same grid as the player.
4492 * Direction "5" is illegal and will (cleanly) abort the command.
4494 * This function tracks and uses the "global direction", and uses
4495 * that as the "desired direction", to which "confusion" is applied.
4497 bool get_rep_dir(int *dp, bool under)
4505 /* Global direction */
4508 #ifdef ALLOW_REPEAT /* TNB */
4510 if (repeat_pull(dp))
4513 /* return (TRUE); */
4516 #endif /* ALLOW_REPEAT -- TNB */
4520 prompt = _("Êý¸þ ('.'¸µ, ESC¤ÇÃæÃÇ)? ", "Direction ('.' at feet, Escape to cancel)? ");
4524 prompt = _("Êý¸þ (ESC¤ÇÃæÃÇ)? ", "Direction (Escape to cancel)? ");
4527 /* Get a direction */
4532 /* Get a command (or Cancel) */
4533 if (!get_com(prompt, &ch, TRUE)) break;
4536 if ((under) && ((ch == '5') || (ch == '-') || (ch == '.')))
4542 /* Look up the direction */
4543 dir = get_keymap_dir(ch);
4550 /* Prevent weirdness */
4551 if ((dir == 5) && (!under)) dir = 0;
4554 if (!dir) return (FALSE);
4556 /* Save desired direction */
4559 /* Apply "confusion" */
4560 if (p_ptr->confused)
4562 /* Standard confusion */
4563 if (randint0(100) < 75)
4565 /* Random direction */
4566 dir = ddd[randint0(8)];
4569 else if (p_ptr->riding)
4571 monster_type *m_ptr = &m_list[p_ptr->riding];
4572 monster_race *r_ptr = &r_info[m_ptr->r_idx];
4574 if (MON_CONFUSED(m_ptr))
4576 /* Standard confusion */
4577 if (randint0(100) < 75)
4579 /* Random direction */
4580 dir = ddd[randint0(8)];
4583 else if ((r_ptr->flags1 & RF1_RAND_50) && (r_ptr->flags1 & RF1_RAND_25) && (randint0(100) < 50))
4585 /* Random direction */
4586 dir = ddd[randint0(8)];
4588 else if ((r_ptr->flags1 & RF1_RAND_50) && (randint0(100) < 25))
4590 /* Random direction */
4591 dir = ddd[randint0(8)];
4595 /* Notice confusion */
4596 if (command_dir != dir)
4598 if (p_ptr->confused)
4602 msg_print("¤¢¤Ê¤¿¤Ïº®Í𤷤Ƥ¤¤ë¡£");
4604 msg_print("You are confused.");
4610 monster_type *m_ptr = &m_list[p_ptr->riding];
4612 monster_desc(m_name, m_ptr, 0);
4613 if (MON_CONFUSED(m_ptr))
4616 msg_format("%s¤Ïº®Í𤷤Ƥ¤¤ë¡£", m_name);
4618 msg_format("%^s is confusing.", m_name);
4625 msg_format("%s¤Ï»×¤¤Ä̤ê¤ËÆ°¤¤¤Æ¤¯¤ì¤Ê¤¤¡£", m_name);
4627 msg_format("You cannot control %s.", m_name);
4633 /* Save direction */
4636 #ifdef ALLOW_REPEAT /* TNB */
4638 /* repeat_push(dir); */
4639 repeat_push(command_dir);
4641 #endif /* ALLOW_REPEAT -- TNB */
4648 bool get_rep_dir2(int *dp)
4655 /* Global direction */
4658 #ifdef ALLOW_REPEAT /* TNB */
4660 if (repeat_pull(dp))
4663 /* return (TRUE); */
4666 #endif /* ALLOW_REPEAT -- TNB */
4668 /* Get a direction */
4673 /* Get a command (or Cancel) */
4675 if (!get_com("Êý¸þ (ESC¤ÇÃæÃÇ)? ", &ch, TRUE)) break;
4677 if (!get_com("Direction (Escape to cancel)? ", &ch, TRUE)) break;
4681 /* Look up the direction */
4682 dir = get_keymap_dir(ch);
4688 /* Prevent weirdness */
4689 if (dir == 5) dir = 0;
4692 if (!dir) return (FALSE);
4694 /* Save desired direction */
4697 /* Apply "confusion" */
4698 if (p_ptr->confused)
4700 /* Standard confusion */
4701 if (randint0(100) < 75)
4703 /* Random direction */
4704 dir = ddd[randint0(8)];
4708 /* Notice confusion */
4709 if (command_dir != dir)
4713 msg_print("¤¢¤Ê¤¿¤Ïº®Í𤷤Ƥ¤¤ë¡£");
4715 msg_print("You are confused.");
4720 /* Save direction */
4723 #ifdef ALLOW_REPEAT /* TNB */
4725 /* repeat_push(dir); */
4726 repeat_push(command_dir);
4728 #endif /* ALLOW_REPEAT -- TNB */
4734 void gain_level_reward(int chosen_reward)
4738 char wrath_reason[32] = "";
4739 int nasty_chance = 6;
4740 int dummy = 0, dummy2 = 0;
4743 char o_name[MAX_NLEN];
4749 if (multi_rew) return;
4750 else multi_rew = TRUE;
4754 if (p_ptr->lev == 13) nasty_chance = 2;
4755 else if (!(p_ptr->lev % 13)) nasty_chance = 3;
4756 else if (!(p_ptr->lev % 14)) nasty_chance = 12;
4758 if (one_in_(nasty_chance))
4759 type = randint1(20); /* Allow the 'nasty' effects */
4761 type = randint1(15) + 5; /* Or disallow them */
4763 if (type < 1) type = 1;
4764 if (type > 20) type = 20;
4769 sprintf(wrath_reason, "%s¤ÎÅܤê",
4770 chaos_patrons[p_ptr->chaos_patron]);
4772 sprintf(wrath_reason, "the Wrath of %s",
4773 chaos_patrons[p_ptr->chaos_patron]);
4777 effect = chaos_rewards[p_ptr->chaos_patron][type];
4779 if (one_in_(6) && !chosen_reward)
4782 msg_format("%^s¤ÏË«Èþ¤È¤·¤Æ¤¢¤Ê¤¿¤òÆÍÁ³ÊÑ°Û¤µ¤»¤¿¡£",
4783 chaos_patrons[p_ptr->chaos_patron]);
4785 msg_format("%^s rewards you with a mutation!",
4786 chaos_patrons[p_ptr->chaos_patron]);
4789 (void)gain_random_mutation(0);
4791 reward = "ÊÑ°Û¤·¤¿¡£";
4793 reward = "mutation";
4798 switch (chosen_reward ? chosen_reward : effect)
4802 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
4803 chaos_patrons[p_ptr->chaos_patron]);
4805 msg_format("The voice of %s booms out:",
4806 chaos_patrons[p_ptr->chaos_patron]);
4810 msg_print("¡ÖÆò¡¢¿·¤¿¤Ê¤ë»Ñ¤òɬÍפȤ»¤ê¡ª¡×");
4812 msg_print("'Thou needst a new form, mortal!'");
4817 reward = "ÊÑ°Û¤·¤¿¡£";
4819 reward = "polymorphing";
4824 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
4825 chaos_patrons[p_ptr->chaos_patron]);
4827 msg_format("The voice of %s booms out:",
4828 chaos_patrons[p_ptr->chaos_patron]);
4832 msg_print("¡ÖÆò¤ÏÎɤ¯¹Ô¤¤¤¿¤ê¡ªÂ³¤±¤è¡ª¡×");
4834 msg_print("'Well done, mortal! Lead on!'");
4837 if (p_ptr->prace == RACE_ANDROID)
4840 msg_print("¤·¤«¤·²¿¤âµ¯¤³¤é¤Ê¤«¤Ã¤¿¡£");
4842 msg_print("But, nothing happen.");
4845 else if (p_ptr->exp < PY_MAX_EXP)
4847 s32b ee = (p_ptr->exp / 2) + 10;
4848 if (ee > 100000L) ee = 100000L;
4850 msg_print("¹¹¤Ë·Ð¸³¤òÀѤó¤À¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£");
4852 msg_print("You feel more experienced.");
4857 reward = "·Ð¸³ÃͤòÆÀ¤¿";
4859 reward = "experience";
4865 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
4866 chaos_patrons[p_ptr->chaos_patron]);
4868 msg_format("The voice of %s booms out:",
4869 chaos_patrons[p_ptr->chaos_patron]);
4873 msg_print("¡Ö²¼Ëͤ衢Æò¤½¤ì¤ËÃͤ»¤º¡£¡×");
4875 msg_print("'Thou didst not deserve that, slave.'");
4878 if (p_ptr->prace == RACE_ANDROID)
4881 msg_print("¤·¤«¤·²¿¤âµ¯¤³¤é¤Ê¤«¤Ã¤¿¡£");
4883 msg_print("But, nothing happen.");
4888 lose_exp(p_ptr->exp / 6);
4890 reward = "·Ð¸³Ãͤò¼º¤Ã¤¿¡£";
4892 reward = "losing experience";
4898 msg_format("%s¤ÎÀ¼¤¬¤µ¤µ¤ä¤¤¤¿:",
4899 chaos_patrons[p_ptr->chaos_patron]);
4901 msg_format("The voice of %s whispers:",
4902 chaos_patrons[p_ptr->chaos_patron]);
4906 msg_print("¡Ö²æ¤¬Í¿¤¨¤·Êª¤ò¸ÌÀ¤Ë»È¤¦¤Ù¤·¡£¡×");
4908 msg_print("'Use my gift wisely.'");
4911 acquirement(py, px, 1, FALSE, FALSE);
4913 reward = "¾å¼Á¤Ê¥¢¥¤¥Æ¥à¤ò¼ê¤ËÆþ¤ì¤¿¡£";
4915 reward = "a good item";
4920 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
4921 chaos_patrons[p_ptr->chaos_patron]);
4923 msg_format("The voice of %s booms out:",
4924 chaos_patrons[p_ptr->chaos_patron]);
4928 msg_print("¡Ö²æ¤¬Í¿¤¨¤·Êª¤ò¸ÌÀ¤Ë»È¤¦¤Ù¤·¡£¡×");
4930 msg_print("'Use my gift wisely.'");
4933 acquirement(py, px, 1, TRUE, FALSE);
4935 reward = "¹âµéÉʤΥ¢¥¤¥Æ¥à¤ò¼ê¤ËÆþ¤ì¤¿¡£";
4937 reward = "an excellent item";
4942 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
4943 chaos_patrons[p_ptr->chaos_patron]);
4945 msg_format("The voice of %s booms out:",
4946 chaos_patrons[p_ptr->chaos_patron]);
4950 msg_print("¡ÖÆò¤Î¹Ô¤¤¤Ïµ®¤·õ¤ËÃͤ»¤ê¡£¡×");
4952 msg_print("'Thy deed hath earned thee a worthy blade.'");
4955 /* Get local object */
4958 switch (randint1(p_ptr->lev))
4964 dummy2 = SV_MAIN_GAUCHE;
4973 dummy2 = SV_SMALL_SWORD;
4976 dummy2 = SV_BASILLARD;
4978 case 11: case 12: case 13:
4979 dummy2 = SV_SHORT_SWORD;
4985 dummy2 = SV_CUTLASS;
4988 dummy2 = SV_WAKIZASHI;
4991 dummy2 = SV_KHOPESH;
4997 dummy2 = SV_BROAD_SWORD;
5000 dummy2 = SV_LONG_SWORD;
5003 dummy2 = SV_SCIMITAR;
5006 dummy2 = SV_NINJATO;
5012 dummy2 = SV_BASTARD_SWORD;
5015 dummy2 = SV_GREAT_SCIMITAR;
5018 dummy2 = SV_CLAYMORE;
5021 dummy2 = SV_ESPADON;
5024 dummy2 = SV_TWO_HANDED_SWORD;
5027 dummy2 = SV_FLAMBERGE;
5030 dummy2 = SV_NO_DACHI;
5033 dummy2 = SV_EXECUTIONERS_SWORD;
5036 dummy2 = SV_ZWEIHANDER;
5039 dummy2 = SV_HAYABUSA;
5042 dummy2 = SV_BLADE_OF_CHAOS;
5045 object_prep(q_ptr, lookup_kind(dummy, dummy2));
5046 q_ptr->to_h = 3 + randint1(dun_level) % 10;
5047 q_ptr->to_d = 3 + randint1(dun_level) % 10;
5048 one_resistance(q_ptr);
5049 q_ptr->name2 = EGO_CHAOTIC;
5051 /* Drop it in the dungeon */
5052 (void)drop_near(q_ptr, -1, py, px);
5054 reward = "(º®ÆÙ)¤ÎÉð´ï¤ò¼ê¤ËÆþ¤ì¤¿¡£";
5056 reward = "chaos weapon";
5061 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5062 chaos_patrons[p_ptr->chaos_patron]);
5064 msg_format("The voice of %s booms out:",
5065 chaos_patrons[p_ptr->chaos_patron]);
5069 msg_print("¡ÖÆò¤Î¹Ô¤¤¤Ïµ®¤Ê󤤤ËÃͤ»¤ê¡£¡×");
5071 msg_print("'Thy deed hath earned thee a worthy reward.'");
5074 acquirement(py, px, randint1(2) + 1, FALSE, FALSE);
5076 reward = "¾å¼Á¤Ê¥¢¥¤¥Æ¥à¤ò¼ê¤ËÆþ¤ì¤¿¡£";
5078 reward = "good items";
5083 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5084 chaos_patrons[p_ptr->chaos_patron]);
5086 msg_format("The voice of %s booms out:",
5087 chaos_patrons[p_ptr->chaos_patron]);
5091 msg_print("¡Ö²¼Ëͤ衢Æò¤Î¸¥¿È¤Ø¤Î²æ¤¬Àˤ·¤ß̵¤Ê󤤤ò¸«¤ë¤¬¤è¤¤¡£¡×");
5093 msg_print("'Behold, mortal, how generously I reward thy loyalty.'");
5096 acquirement(py, px, randint1(2) + 1, TRUE, FALSE);
5098 reward = "¹âµéÉʤΥ¢¥¤¥Æ¥à¤ò¼ê¤ËÆþ¤ì¤¿¡£";
5100 reward = "excellent items";
5105 msg_format("%s¤ÎÀ¼¤¬¹ì¤ÅϤä¿:",
5106 chaos_patrons[p_ptr->chaos_patron]);
5108 msg_format("The voice of %s thunders:",
5109 chaos_patrons[p_ptr->chaos_patron]);
5113 msg_print("¡Ö²¼Ëͤ衢ÆòÐþËý¤Ê¤ê¡£¡×");
5115 msg_print("'Thou art growing arrogant, mortal.'");
5118 (void)activate_ty_curse(FALSE, &count);
5120 reward = "²Ò¡¹¤·¤¤¼ö¤¤¤ò¤«¤±¤é¤ì¤¿¡£";
5127 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5128 chaos_patrons[p_ptr->chaos_patron]);
5130 msg_format("The voice of %s booms out:",
5131 chaos_patrons[p_ptr->chaos_patron]);
5135 msg_print("¡Ö²æ¤¬²¼Ëͤ¿¤Á¤è¡¢¤«¤ÎÐþËý¤Ê¤ë¼Ô¤òÅݤ¹¤Ù¤·¡ª¡×");
5137 msg_print("'My pets, destroy the arrogant mortal!'");
5140 for (dummy = 0; dummy < randint1(5) + 1; dummy++)
5142 (void)summon_specific(0, py, px, dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
5145 reward = "¥â¥ó¥¹¥¿¡¼¤ò¾¤´¤µ¤ì¤¿¡£";
5147 reward = "summoning hostile monsters";
5152 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5153 chaos_patrons[p_ptr->chaos_patron]);
5155 msg_format("The voice of %s booms out:",
5156 chaos_patrons[p_ptr->chaos_patron]);
5160 msg_print("¡ÖÆò¡¢¤è¤ê¶¯¤Å¨¤òɬÍפȤ»¤ê¡ª¡×");
5162 msg_print("'Thou needst worthier opponents!'");
5165 activate_hi_summon(py, px, FALSE);
5167 reward = "¥â¥ó¥¹¥¿¡¼¤ò¾¤´¤µ¤ì¤¿¡£";
5169 reward = "summoning many hostile monsters";
5174 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5175 chaos_patrons[p_ptr->chaos_patron]);
5177 msg_format("The voice of %s booms out:",
5178 chaos_patrons[p_ptr->chaos_patron]);
5182 msg_print("¡Ö»à¤ÈÇ˲õ¤³¤½²æ¤¬´î¤Ó¤Ê¤ê¡ª¡×");
5184 msg_print("'Death and destruction! This pleaseth me!'");
5189 reward = "¥«¥ª¥¹¤ÎÎϤ¬±²´¬¤¤¤¿¡£";
5191 reward = "calling chaos";
5196 msg_format("%s¤ÎÀ¼¤¬ÌĤê¶Á¤¤¤¿:",
5197 chaos_patrons[p_ptr->chaos_patron]);
5199 msg_format("The voice of %s rings out:",
5200 chaos_patrons[p_ptr->chaos_patron]);
5204 msg_print("¡Öα¤Þ¤ë¤Î¤À¡¢²¼Ëͤ衣;¤¬Æò¤ÎÆùÂΤòÃ䨤󡣡×");
5206 msg_print("'Stay, mortal, and let me mold thee.'");
5209 if (one_in_(3) && !(chaos_stats[p_ptr->chaos_patron] < 0))
5210 do_inc_stat(chaos_stats[p_ptr->chaos_patron]);
5212 do_inc_stat(randint0(6));
5214 reward = "ǽÎÏÃͤ¬¾å¤¬¤Ã¤¿¡£";
5216 reward = "increasing a stat";
5221 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5222 chaos_patrons[p_ptr->chaos_patron]);
5224 msg_format("The voice of %s booms out:",
5225 chaos_patrons[p_ptr->chaos_patron]);
5229 msg_print("¡Ö²¼Ëͤ衢;¤ÏÆò¤ËË°¤ß¤¿¤ê¡£¡×");
5231 msg_print("'I grow tired of thee, mortal.'");
5234 if (one_in_(3) && !(chaos_stats[p_ptr->chaos_patron] < 0))
5235 do_dec_stat(chaos_stats[p_ptr->chaos_patron]);
5237 (void)do_dec_stat(randint0(6));
5239 reward = "ǽÎÏÃͤ¬²¼¤¬¤Ã¤¿¡£";
5241 reward = "decreasing a stat";
5246 msg_format("%s¤ÎÀ¼¤¬¹ì¤ÅϤä¿:",
5247 chaos_patrons[p_ptr->chaos_patron]);
5249 msg_format("The voice of %s thunders:",
5250 chaos_patrons[p_ptr->chaos_patron]);
5254 msg_print("¡ÖÆò¡¢¸¬µõ¤¿¤ë¤³¤È¤ò³Ø¤Ö¤Ù¤·¡ª¡×");
5255 msg_print("¤¢¤Ê¤¿¤Ï°ÊÁ°¤è¤ê¼å¤¯¤Ê¤Ã¤¿¡ª");
5257 msg_print("'Thou needst a lesson in humility, mortal!'");
5258 msg_print("You feel less powerful!");
5261 for (dummy = 0; dummy < 6; dummy++)
5263 (void)dec_stat(dummy, 10 + randint1(15), TRUE);
5266 reward = "Á´Ç½ÎÏÃͤ¬²¼¤¬¤Ã¤¿¡£";
5268 reward = "decreasing all stats";
5273 msg_format("%s¤ÎÎϤ¬¿¨¤ì¤ë¤Î¤ò´¶¤¸¤¿¡£",
5275 msg_format("You feel the power of %s touch you.",
5278 chaos_patrons[p_ptr->chaos_patron]);
5281 reward = "½ý¤¬ÊѲ½¤·¤¿¡£";
5283 reward = "polymorphing wounds";
5288 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5289 chaos_patrons[p_ptr->chaos_patron]);
5291 msg_format("The voice of %s booms out:",
5292 chaos_patrons[p_ptr->chaos_patron]);
5296 msg_print("¡Ö²æ¤¬¤µ¤µ¤ä¤«¤Ê¤ë»òʪ¤ò¼õ¤±¤È¤ë¤¬¤è¤¤¡ª¡×");
5298 msg_print("'Receive this modest gift from me!'");
5301 for (dummy = 0; dummy < 6; dummy++)
5303 (void)do_inc_stat(dummy);
5306 reward = "Á´Ç½ÎÏÃͤ¬¾å¤¬¤Ã¤¿¡£";
5308 reward = "increasing all stats";
5313 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5314 chaos_patrons[p_ptr->chaos_patron]);
5316 msg_format("The voice of %s booms out:",
5317 chaos_patrons[p_ptr->chaos_patron]);
5321 msg_print("¡Ö¶ì¤·¤à¤¬¤è¤¤¡¢ÌµÇ½¤Ê¶ò¤«¼Ô¤è¡ª¡×");
5323 msg_print("'Suffer, pathetic fool!'");
5326 fire_ball(GF_DISINTEGRATE, 0, p_ptr->lev * 4, 4);
5327 take_hit(DAMAGE_NOESCAPE, p_ptr->lev * 4, wrath_reason, -1);
5329 reward = "ʬ²ò¤Îµå¤¬È¯À¸¤·¤¿¡£";
5331 reward = "generating disintegration ball";
5336 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5337 chaos_patrons[p_ptr->chaos_patron]);
5339 msg_format("The voice of %s booms out:",
5340 chaos_patrons[p_ptr->chaos_patron]);
5344 msg_print("¡Öᴤ뤬¤è¤¤¡¢²æ¤¬²¼Ëͤ衪¡×");
5346 msg_print("'Rise, my servant!'");
5350 (void)set_poisoned(0);
5352 (void)set_confused(0);
5357 for (dummy = 0; dummy < 6; dummy++)
5359 (void)do_res_stat(dummy);
5362 reward = "ÂÎÎϤ¬²óÉü¤·¤¿¡£";
5368 if (!buki_motteruka(INVEN_RARM) && !buki_motteruka(INVEN_LARM)) break;
5370 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5371 chaos_patrons[p_ptr->chaos_patron]);
5373 msg_format("The voice of %s booms out:",
5374 chaos_patrons[p_ptr->chaos_patron]);
5378 msg_print("¡ÖÆò¡¢Éð´ï¤ËÍê¤ë¤³¤È¤Ê¤«¤ì¡£¡×");
5380 msg_print("'Thou reliest too much on thy weapon.'");
5384 if (buki_motteruka(INVEN_LARM))
5387 if (buki_motteruka(INVEN_RARM) && one_in_(2)) dummy = INVEN_RARM;
5389 object_desc(o_name, &inventory[dummy], OD_NAME_ONLY);
5390 (void)curse_weapon(FALSE, dummy);
5392 reward = format("%s¤¬Ç˲õ¤µ¤ì¤¿¡£", o_name);
5394 reward = format("destroying %s", o_name);
5398 if (!inventory[INVEN_BODY].k_idx) break;
5400 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5401 chaos_patrons[p_ptr->chaos_patron]);
5403 msg_format("The voice of %s booms out:",
5404 chaos_patrons[p_ptr->chaos_patron]);
5408 msg_print("¡ÖÆò¡¢Ëɶñ¤ËÍê¤ë¤³¤È¤Ê¤«¤ì¡£¡×");
5410 msg_print("'Thou reliest too much on thine equipment.'");
5413 object_desc(o_name, &inventory[INVEN_BODY], OD_NAME_ONLY);
5414 (void)curse_armor();
5416 reward = format("%s¤¬Ç˲õ¤µ¤ì¤¿¡£", o_name);
5418 reward = format("destroying %s", o_name);
5423 msg_format("%s¤ÎÀ¼¤¬¤µ¤µ¤ä¤¤¤¿:",
5424 chaos_patrons[p_ptr->chaos_patron]);
5426 msg_format("The voice of %s whispers:",
5427 chaos_patrons[p_ptr->chaos_patron]);
5431 msg_print("¡Ö²æ¤òÅܤꤷ¤á¤¿ºá¤ò½þ¤¦¤Ù¤·¡£¡×");
5433 msg_print("'Now thou shalt pay for annoying me.'");
5436 switch (randint1(4))
5439 (void)activate_ty_curse(FALSE, &count);
5441 reward = "²Ò¡¹¤·¤¤¼ö¤¤¤ò¤«¤±¤é¤ì¤¿¡£";
5447 activate_hi_summon(py, px, FALSE);
5449 reward = "¥â¥ó¥¹¥¿¡¼¤ò¾¤´¤µ¤ì¤¿¡£";
5451 reward = "summoning hostile monsters";
5457 if (!buki_motteruka(INVEN_RARM) && !buki_motteruka(INVEN_LARM)) break;
5459 if (buki_motteruka(INVEN_LARM))
5462 if (buki_motteruka(INVEN_RARM) && one_in_(2)) dummy = INVEN_RARM;
5464 object_desc(o_name, &inventory[dummy], OD_NAME_ONLY);
5465 (void)curse_weapon(FALSE, dummy);
5467 reward = format("%s¤¬Ç˲õ¤µ¤ì¤¿¡£", o_name);
5469 reward = format("destroying %s", o_name);
5474 if (!inventory[INVEN_BODY].k_idx) break;
5475 object_desc(o_name, &inventory[INVEN_BODY], OD_NAME_ONLY);
5476 (void)curse_armor();
5478 reward = format("%s¤¬Ç˲õ¤µ¤ì¤¿¡£", o_name);
5480 reward = format("destroying %s", o_name);
5485 for (dummy = 0; dummy < 6; dummy++)
5487 (void)dec_stat(dummy, 10 + randint1(15), TRUE);
5490 reward = "Á´Ç½ÎÏÃͤ¬²¼¤¬¤Ã¤¿¡£";
5492 reward = "decreasing all stats";
5499 msg_format("%s¤ÎÀ¼¤¬¹ì¤ÅϤä¿:",
5501 msg_format("The voice of %s thunders:",
5504 chaos_patrons[p_ptr->chaos_patron]);
5506 msg_print("¡Ö»à¤Ì¤¬¤è¤¤¡¢²¼Ëͤ衪¡×");
5508 msg_print("'Die, mortal!'");
5511 take_hit(DAMAGE_LOSELIFE, p_ptr->lev * 4, wrath_reason, -1);
5512 for (dummy = 0; dummy < 6; dummy++)
5514 (void)dec_stat(dummy, 10 + randint1(15), FALSE);
5516 activate_hi_summon(py, px, FALSE);
5517 (void)activate_ty_curse(FALSE, &count);
5522 if (buki_motteruka(INVEN_RARM))
5525 if (buki_motteruka(INVEN_LARM) && one_in_(2)) dummy = INVEN_LARM;
5527 else if (buki_motteruka(INVEN_LARM)) dummy = INVEN_LARM;
5529 if (dummy) (void)curse_weapon(FALSE, dummy);
5531 if (one_in_(2)) (void)curse_armor();
5535 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5536 chaos_patrons[p_ptr->chaos_patron]);
5538 msg_format("The voice of %s booms out:",
5539 chaos_patrons[p_ptr->chaos_patron]);
5543 msg_print("¡Ö»à¤ÈÇ˲õ¤³¤½²æ¤¬´î¤Ó¤Ê¤ê¡ª¡×");
5545 msg_print("'Death and destruction! This pleaseth me!'");
5548 (void)destroy_area(py, px, 25, FALSE);
5550 reward = "¥À¥ó¥¸¥ç¥ó¤¬*Ç˲õ*¤µ¤ì¤¿¡£";
5552 reward = "*destruct*ing dungeon";
5557 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5558 chaos_patrons[p_ptr->chaos_patron]);
5560 msg_format("The voice of %s booms out:",
5561 chaos_patrons[p_ptr->chaos_patron]);
5565 msg_print("¡Ö²æ¡¢Æò¤ÎŨ¤òËõ»¦¤»¤ó¡ª¡×");
5567 msg_print("'Let me relieve thee of thine oppressors!'");
5570 (void)symbol_genocide(0, FALSE);
5572 reward = "¥â¥ó¥¹¥¿¡¼¤¬Ëõ»¦¤µ¤ì¤¿¡£";
5574 reward = "genociding monsters";
5579 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5580 chaos_patrons[p_ptr->chaos_patron]);
5582 msg_format("The voice of %s booms out:",
5583 chaos_patrons[p_ptr->chaos_patron]);
5587 msg_print("¡Ö²æ¡¢Æò¤ÎŨ¤òËõ»¦¤»¤ó¡ª¡×");
5589 msg_print("'Let me relieve thee of thine oppressors!'");
5592 (void)mass_genocide(0, FALSE);
5594 reward = "¥â¥ó¥¹¥¿¡¼¤¬Ëõ»¦¤µ¤ì¤¿¡£";
5596 reward = "genociding nearby monsters";
5601 msg_format("%s¤ÎÎϤ¬Å¨¤ò¹¶·â¤¹¤ë¤Î¤ò´¶¤¸¤¿¡ª",
5602 chaos_patrons[p_ptr->chaos_patron]);
5604 msg_format("You can feel the power of %s assault your enemies!",
5605 chaos_patrons[p_ptr->chaos_patron]);
5608 (void)dispel_monsters(p_ptr->lev * 4);
5612 msg_format("%s¤Ï¤¢¤Ê¤¿¤ò̵»ë¤·¤¿¡£",
5613 chaos_patrons[p_ptr->chaos_patron]);
5615 msg_format("%s ignores you.",
5616 chaos_patrons[p_ptr->chaos_patron]);
5622 msg_format("%s¤ÏË«Èþ¤È¤·¤Æ°Ëâ¤Î»È¤¤¤ò¤è¤³¤·¤¿¡ª",chaos_patrons[p_ptr->chaos_patron]);
5624 msg_format("%s rewards you with a demonic servant!",chaos_patrons[p_ptr->chaos_patron]);
5627 if (!summon_specific(-1, py, px, dun_level, SUMMON_DEMON, PM_FORCE_PET))
5629 msg_print("²¿¤â¸½¤ì¤Ê¤«¤Ã¤¿...");
5631 msg_print("Nobody ever turns up...");
5635 reward = "°Ë⤬¥Ú¥Ã¥È¤Ë¤Ê¤Ã¤¿¡£";
5637 reward = "a demonic servant";
5643 msg_format("%s¤ÏË«Èþ¤È¤·¤Æ»È¤¤¤ò¤è¤³¤·¤¿¡ª",chaos_patrons[p_ptr->chaos_patron]);
5645 msg_format("%s rewards you with a servant!",chaos_patrons[p_ptr->chaos_patron]);
5648 if (!summon_specific(-1, py, px, dun_level, 0, PM_FORCE_PET))
5650 msg_print("²¿¤â¸½¤ì¤Ê¤«¤Ã¤¿...");
5652 msg_print("Nobody ever turns up...");
5656 reward = "¥â¥ó¥¹¥¿¡¼¤¬¥Ú¥Ã¥È¤Ë¤Ê¤Ã¤¿¡£";
5658 reward = "a servant";
5664 msg_format("%s¤ÏË«Èþ¤È¤·¤Æ¥¢¥ó¥Ç¥Ã¥É¤Î»È¤¤¤ò¤è¤³¤·¤¿¡£",chaos_patrons[p_ptr->chaos_patron]);
5666 msg_format("%s rewards you with an undead servant!",chaos_patrons[p_ptr->chaos_patron]);
5669 if (!summon_specific(-1, py, px, dun_level, SUMMON_UNDEAD, PM_FORCE_PET))
5671 msg_print("²¿¤â¸½¤ì¤Ê¤«¤Ã¤¿...");
5673 msg_print("Nobody ever turns up...");
5677 reward = "¥¢¥ó¥Ç¥Ã¥É¤¬¥Ú¥Ã¥È¤Ë¤Ê¤Ã¤¿¡£";
5679 reward = "an undead servant";
5685 msg_format("%s¤ÎÀ¼¤¬¤É¤â¤Ã¤¿:",
5687 msg_format("The voice of %s stammers:",
5690 chaos_patrons[p_ptr->chaos_patron]);
5692 msg_format("¡Ö¤¢¡¼¡¢¤¢¡¼¡¢Åú¤¨¤Ï %d/%d¡£¼ÁÌä¤Ï²¿¡©¡×", type, effect);
5694 msg_format("'Uh... uh... the answer's %d/%d, what's the question?'", type, effect);
5702 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, format("¥Ñ¥È¥í¥ó¤ÎÊó½·¤Ç%s", reward));
5704 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, format("The patron rewards you with %s.", reward));
5711 * XAngband: determine if a given location is "interesting"
5712 * based on target_set_accept function.
5714 static bool tgt_pt_accept(int y, int x)
5719 if (!(in_bounds(y, x))) return (FALSE);
5721 /* Player grid is always interesting */
5722 if ((y == py) && (x == px)) return (TRUE);
5724 /* Handle hallucination */
5725 if (p_ptr->image) return (FALSE);
5727 /* Examine the grid */
5728 c_ptr = &cave[y][x];
5730 /* Interesting memorized features */
5731 if (c_ptr->info & (CAVE_MARK))
5734 if (cave_have_flag_grid(c_ptr, FF_LESS)) return (TRUE);
5735 if (cave_have_flag_grid(c_ptr, FF_MORE)) return (TRUE);
5737 /* Notice quest features */
5738 if (cave_have_flag_grid(c_ptr, FF_QUEST_ENTER)) return (TRUE);
5739 if (cave_have_flag_grid(c_ptr, FF_QUEST_EXIT)) return (TRUE);
5748 * XAngband: Prepare the "temp" array for "tget_pt"
5749 * based on target_set_prepare funciton.
5751 static void tgt_pt_prepare(void)
5755 /* Reset "temp" array */
5758 if (!expand_list) return;
5760 /* Scan the current panel */
5761 for (y = 1; y < cur_hgt; y++)
5763 for (x = 1; x < cur_wid; x++)
5765 /* Require "interesting" contents */
5766 if (!tgt_pt_accept(y, x)) continue;
5768 /* Save the location */
5775 /* Target the nearest monster for shooting */
5776 ang_sort_comp = ang_sort_comp_distance;
5777 ang_sort_swap = ang_sort_swap_distance;
5779 /* Sort the positions */
5780 ang_sort(temp_x, temp_y, temp_n);
5784 * old -- from PsiAngband.
5786 bool tgt_pt(int *x_ptr, int *y_ptr)
5790 bool success = FALSE;
5795 get_screen_size(&wid, &hgt);
5807 msg_print("¾ì½ê¤òÁª¤ó¤Ç¥¹¥Ú¡¼¥¹¥¡¼¤ò²¡¤·¤Æ²¼¤µ¤¤¡£");
5809 msg_print("Select a point and press space.");
5811 msg_flag = FALSE; /* prevents "-more-" message. */
5813 while ((ch != ESCAPE) && !success)
5815 bool move_fast = FALSE;
5817 move_cursor_relative(y, x);
5829 if (player_bold(y, x)) ch = 0;
5832 else success = TRUE;
5836 /* XAngband: Move cursor to stairs */
5839 if (expand_list && temp_n)
5842 int cx = (panel_col_min + panel_col_max) / 2;
5843 int cy = (panel_row_min + panel_row_max) / 2;
5847 while(n < temp_n) /* Skip stairs which have defferent distance */
5849 cave_type *c_ptr = &cave[temp_y[n]][temp_x[n]];
5853 if (cave_have_flag_grid(c_ptr, FF_LESS) ||
5854 cave_have_flag_grid(c_ptr, FF_QUEST_ENTER))
5859 else /* if (ch == '<') */
5861 if (cave_have_flag_grid(c_ptr, FF_MORE) ||
5862 cave_have_flag_grid(c_ptr, FF_QUEST_EXIT))
5869 if (n == temp_n) /* Loop out taget list */
5874 verify_panel(); /* Move cursor to player */
5877 p_ptr->update |= (PU_MONSTERS);
5880 p_ptr->redraw |= (PR_MAP);
5883 p_ptr->window |= (PW_OVERHEAD);
5888 else /* move cursor to next stair and change panel */
5893 dy = 2 * (y - cy) / hgt;
5894 dx = 2 * (x - cx) / wid;
5895 if (dy || dx) change_panel(dy, dx);
5901 /* Look up the direction */
5902 d = get_keymap_dir(ch);
5904 /* XTRA HACK MOVEFAST */
5905 if (isupper(ch)) move_fast = TRUE;
5907 /* Handle "direction" */
5913 /* XTRA HACK MOVEFAST */
5916 int mag = MIN(wid / 2, hgt / 2);
5926 /* Do not move horizontally if unnecessary */
5927 if (((x < panel_col_min + wid / 2) && (dx > 0)) ||
5928 ((x > panel_col_min + wid / 2) && (dx < 0)))
5933 /* Do not move vertically if unnecessary */
5934 if (((y < panel_row_min + hgt / 2) && (dy > 0)) ||
5935 ((y > panel_row_min + hgt / 2) && (dy < 0)))
5940 /* Apply the motion */
5941 if ((y >= panel_row_min + hgt) || (y < panel_row_min) ||
5942 (x >= panel_col_min + wid) || (x < panel_col_min))
5944 /* if (change_panel(dy, dx)) target_set_prepare(mode); */
5945 change_panel(dy, dx);
5948 /* Slide into legality */
5949 if (x >= cur_wid-1) x = cur_wid - 2;
5950 else if (x <= 0) x = 1;
5952 /* Slide into legality */
5953 if (y >= cur_hgt-1) y = cur_hgt- 2;
5954 else if (y <= 0) y = 1;
5961 /* Clear the top line */
5964 /* Recenter the map around the player */
5968 p_ptr->update |= (PU_MONSTERS);
5971 p_ptr->redraw |= (PR_MAP);
5974 p_ptr->window |= (PW_OVERHEAD);
5985 bool get_hack_dir(int *dp)
5995 /* Global direction */
5998 /* (No auto-targeting) */
6000 /* Ask until satisfied */
6003 /* Choose a prompt */
6007 p = "Êý¸þ ('*'¤Ç¥¿¡¼¥²¥Ã¥ÈÁªÂò, ESC¤ÇÃæÃÇ)? ";
6009 p = "Direction ('*' to choose a target, Escape to cancel)? ";
6016 p = "Êý¸þ ('5'¤Ç¥¿¡¼¥²¥Ã¥È¤Ø, '*'¤Ç¥¿¡¼¥²¥Ã¥ÈºÆÁªÂò, ESC¤ÇÃæÃÇ)? ";
6018 p = "Direction ('5' for target, '*' to re-target, Escape to cancel)? ";
6023 /* Get a command (or Cancel) */
6024 if (!get_com(p, &command, TRUE)) break;
6028 if (command == '\r') command = 't';
6031 /* Convert various keys to "standard" keys */
6034 /* Use current target */
6045 /* Set new target */
6050 if (target_set(TARGET_KILL)) dir = 5;
6056 /* Look up the direction */
6057 dir = get_keymap_dir(command);
6063 /* Verify requested targets */
6064 if ((dir == 5) && !target_okay()) dir = 0;
6071 if (!dir) return (FALSE);
6073 /* Save the direction */
6076 /* Check for confusion */
6077 if (p_ptr->confused)
6080 /* Random direction */
6081 dir = ddd[randint0(8)];
6084 /* Notice confusion */
6085 if (command_dir != dir)
6089 msg_print("¤¢¤Ê¤¿¤Ïº®Í𤷤Ƥ¤¤ë¡£");
6091 msg_print("You are confused.");
6096 /* Save direction */
6099 /* A "valid" direction was entered */
6105 * ¥¨¥Í¥ë¥®¡¼¤ÎÁý²ÃÎÌ10d5¤ò®¤¯·×»»¤¹¤ë¤¿¤á¤Î´Ø¿ô
6108 #define Go_no_JuuJou 5*5*5*5*5*5*5*5*5*5
6110 s16b gain_energy(void)
6113 s32b energy_result = 10;
6116 tmp = randint0(Go_no_JuuJou);
6118 for (i = 0; i < 9; i ++){
6119 energy_result += tmp % 5;
6123 return (s16b)(energy_result + tmp);
6130 s16b bow_energy(int sval)
6134 /* Analyze the launcher */
6137 /* Sling and ammo */
6144 /* Short Bow and Arrow */
6151 /* Long Bow and Arrow */
6158 /* Bow of irresponsiblity and Arrow */
6165 /* Light Crossbow and Bolt */
6172 /* Heavy Crossbow and Bolt */
6187 int bow_tmul(int sval)
6191 /* Analyze the launcher */
6194 /* Sling and ammo */
6201 /* Short Bow and Arrow */
6208 /* Long Bow and Arrow */
6215 /* Bow of irresponsiblity and Arrow */
6222 /* Light Crossbow and Bolt */
6229 /* Heavy Crossbow and Bolt */
6241 * Return alignment title
6243 cptr your_alignment(void)
6246 if (p_ptr->align > 150) return "ÂçÁ±";
6247 else if (p_ptr->align > 50) return "ÃæÁ±";
6248 else if (p_ptr->align > 10) return "¾®Á±";
6249 else if (p_ptr->align > -11) return "ÃæΩ";
6250 else if (p_ptr->align > -51) return "¾®°";
6251 else if (p_ptr->align > -151) return "Ãæ°";
6254 if (p_ptr->align > 150) return "Lawful";
6255 else if (p_ptr->align > 50) return "Good";
6256 else if (p_ptr->align > 10) return "Neutral Good";
6257 else if (p_ptr->align > -11) return "Neutral";
6258 else if (p_ptr->align > -51) return "Neutral Evil";
6259 else if (p_ptr->align > -151) return "Evil";
6260 else return "Chaotic";
6266 * Return proficiency level of weapons and misc. skills (except riding)
6268 int weapon_exp_level(int weapon_exp)
6270 if (weapon_exp < WEAPON_EXP_BEGINNER) return EXP_LEVEL_UNSKILLED;
6271 else if (weapon_exp < WEAPON_EXP_SKILLED) return EXP_LEVEL_BEGINNER;
6272 else if (weapon_exp < WEAPON_EXP_EXPERT) return EXP_LEVEL_SKILLED;
6273 else if (weapon_exp < WEAPON_EXP_MASTER) return EXP_LEVEL_EXPERT;
6274 else return EXP_LEVEL_MASTER;
6279 * Return proficiency level of riding
6281 int riding_exp_level(int riding_exp)
6283 if (riding_exp < RIDING_EXP_BEGINNER) return EXP_LEVEL_UNSKILLED;
6284 else if (riding_exp < RIDING_EXP_SKILLED) return EXP_LEVEL_BEGINNER;
6285 else if (riding_exp < RIDING_EXP_EXPERT) return EXP_LEVEL_SKILLED;
6286 else if (riding_exp < RIDING_EXP_MASTER) return EXP_LEVEL_EXPERT;
6287 else return EXP_LEVEL_MASTER;
6292 * Return proficiency level of spells
6294 int spell_exp_level(int spell_exp)
6296 if (spell_exp < SPELL_EXP_BEGINNER) return EXP_LEVEL_UNSKILLED;
6297 else if (spell_exp < SPELL_EXP_SKILLED) return EXP_LEVEL_BEGINNER;
6298 else if (spell_exp < SPELL_EXP_EXPERT) return EXP_LEVEL_SKILLED;
6299 else if (spell_exp < SPELL_EXP_MASTER) return EXP_LEVEL_EXPERT;
6300 else return EXP_LEVEL_MASTER;
6305 * Display a rumor and apply its effects
6308 int rumor_num(char *zz, int max_idx)
6310 if (strcmp(zz, "*") == 0) return randint1(max_idx - 1);
6314 cptr rumor_bind_name(char *base, cptr fullname)
6318 s = strstr(base, "{Name}");
6322 v = format("%s%s%s", base, fullname, (s + 6));
6332 void display_rumor(bool ex)
6340 if (randint0(3) == 0) section = 1;
6344 err = get_rnd_line_jonly("rumors_j.txt", section, Rumor, 10);
6345 if (err) strcpy(Rumor, "±³¤Î±½¤â¤¢¤ë¡£");
6347 err = get_rnd_line("rumors.txt", section, Rumor);
6348 if (err) strcpy(Rumor, "Some rumors are wrong.");
6353 if (strncmp(Rumor, "R:", 2) == 0)
6356 cptr rumor_msg = NULL;
6357 cptr rumor_eff_format = NULL;
6358 char fullname[1024] = "";
6360 if (tokenize(Rumor + 2, 3, zz, TOKENIZE_CHECKQUOTE) == 3)
6362 if (strcmp(zz[0], "ARTIFACT") == 0)
6366 object_type *q_ptr = &forge;
6367 artifact_type *a_ptr;
6371 a_idx = rumor_num(zz[1], max_a_idx);
6373 a_ptr = &a_info[a_idx];
6374 if (a_ptr->name) break;
6377 k_idx = lookup_kind(a_ptr->tval, a_ptr->sval);
6378 object_prep(q_ptr, k_idx);
6379 q_ptr->name1 = a_idx;
6380 q_ptr->ident = IDENT_STORE;
6381 object_desc(fullname, q_ptr, OD_NAME_ONLY);
6383 else if (strcmp(zz[0], "MONSTER") == 0)
6386 monster_race *r_ptr;
6390 r_idx = rumor_num(zz[1], max_r_idx);
6391 r_ptr = &r_info[r_idx];
6392 if (r_ptr->name) break;
6395 strcpy(fullname, r_name + r_ptr->name);
6397 /* Remember this monster */
6398 if (!r_ptr->r_sights)
6403 else if (strcmp(zz[0], "DUNGEON") == 0)
6406 dungeon_info_type *d_ptr;
6410 d_idx = rumor_num(zz[1], max_d_idx);
6411 d_ptr = &d_info[d_idx];
6412 if (d_ptr->name) break;
6415 strcpy(fullname, d_name + d_ptr->name);
6417 if (!max_dlv[d_idx])
6419 max_dlv[d_idx] = d_ptr->mindepth;
6420 rumor_eff_format = _("%s¤Ëµ¢´Ô¤Ç¤¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¡£", "You can recall to %s.");
6423 else if (strcmp(zz[0], "TOWN") == 0)
6430 t_idx = rumor_num(zz[1], NO_TOWN);
6431 if (town[t_idx].name) break;
6434 strcpy(fullname, town[t_idx].name);
6436 visit = (1L << (t_idx - 1));
6437 if ((t_idx != SECRET_TOWN) && !(p_ptr->visit & visit))
6439 p_ptr->visit |= visit;
6440 rumor_eff_format = _("%s¤Ë¹Ô¤Ã¤¿¤³¤È¤¬¤¢¤ëµ¤¤¬¤¹¤ë¡£", "You feel you have been to %s.");
6444 rumor_msg = rumor_bind_name(zz[2], fullname);
6445 msg_print(rumor_msg);
6446 if (rumor_eff_format)
6449 msg_format(rumor_eff_format, fullname);
6455 if (err) msg_print("¤³¤Î¾ðÊó¤Ï´Ö°ã¤Ã¤Æ¤¤¤ë¡£");
6457 if (err) msg_print("This information is wrong.");
6462 msg_format("%s", Rumor);