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 */
381 * Check for "Quest" completion when a quest monster is killed or charmed.
383 void check_quest_completion(monster_type *m_ptr)
385 int i, j, y, x, ny, nx, i2, j2;
389 bool create_stairs = FALSE;
395 /* Get the location */
400 quest_num = p_ptr->inside_quest;
402 /* Search for an active quest on this dungeon level */
405 for (i = max_quests - 1; i > 0; i--)
407 /* Quest is not active */
408 if (quest[i].status != QUEST_STATUS_TAKEN)
411 /* Quest is not a dungeon quest */
412 if (quest[i].flags & QUEST_FLAG_PRESET)
415 /* Quest is not on this level */
416 if ((quest[i].level != dun_level) &&
417 (quest[i].type != QUEST_TYPE_KILL_ANY_LEVEL))
420 /* Not a "kill monster" quest */
421 if ((quest[i].type == QUEST_TYPE_FIND_ARTIFACT) ||
422 (quest[i].type == QUEST_TYPE_FIND_EXIT))
425 /* Interesting quest */
426 if ((quest[i].type == QUEST_TYPE_KILL_NUMBER) ||
427 (quest[i].type == QUEST_TYPE_KILL_ALL))
430 /* Interesting quest */
431 if (((quest[i].type == QUEST_TYPE_KILL_LEVEL) ||
432 (quest[i].type == QUEST_TYPE_KILL_ANY_LEVEL) ||
433 (quest[i].type == QUEST_TYPE_RANDOM)) &&
434 (quest[i].r_idx == m_ptr->r_idx))
441 /* Handle the current quest */
442 if (quest_num && (quest[quest_num].status == QUEST_STATUS_TAKEN))
447 switch (quest[i].type)
449 case QUEST_TYPE_KILL_NUMBER:
453 if (quest[i].cur_num >= quest[i].num_mon)
455 if (record_fix_quest) do_cmd_write_nikki(NIKKI_FIX_QUEST_C, i, NULL);
456 /* completed quest */
457 quest[i].status = QUEST_STATUS_COMPLETED;
458 quest[i].complev = (byte)p_ptr->lev;
460 if (!(quest[i].flags & QUEST_FLAG_SILENT))
463 msg_print("¥¯¥¨¥¹¥È¤òãÀ®¤·¤¿¡ª");
465 msg_print("You just completed your quest!");
471 quest[i].cur_num = 0;
475 case QUEST_TYPE_KILL_ALL:
479 if (!is_hostile(m_ptr)) break;
481 /* Count all hostile monsters */
482 for (i2 = 0; i2 < cur_wid; ++i2)
483 for (j2 = 0; j2 < cur_hgt; j2++)
484 if (cave[j2][i2].m_idx > 0)
485 if (is_hostile(&m_list[cave[j2][i2].m_idx]))
488 if ((number_mon - 1) == 0)
490 if (record_fix_quest) do_cmd_write_nikki(NIKKI_FIX_QUEST_C, i, NULL);
492 if (quest[i].flags & QUEST_FLAG_SILENT)
494 quest[i].status = QUEST_STATUS_FINISHED;
498 quest[i].status = QUEST_STATUS_COMPLETED;
499 quest[i].complev = (byte)p_ptr->lev;
501 msg_print("¥¯¥¨¥¹¥È¤òãÀ®¤·¤¿¡ª");
503 msg_print("You just completed your quest!");
511 case QUEST_TYPE_KILL_LEVEL:
512 case QUEST_TYPE_RANDOM:
514 /* Only count valid monsters */
515 if (quest[i].r_idx != m_ptr->r_idx)
520 if (quest[i].cur_num >= quest[i].max_num)
522 if (record_fix_quest && (quest[i].type == QUEST_TYPE_KILL_LEVEL)) do_cmd_write_nikki(NIKKI_FIX_QUEST_C, i, NULL);
523 if (record_rand_quest && (quest[i].type == QUEST_TYPE_RANDOM)) do_cmd_write_nikki(NIKKI_RAND_QUEST_C, i, NULL);
524 /* completed quest */
525 quest[i].status = QUEST_STATUS_COMPLETED;
526 quest[i].complev = (byte)p_ptr->lev;
527 if (!(quest[i].flags & QUEST_FLAG_PRESET))
529 create_stairs = TRUE;
530 p_ptr->inside_quest = 0;
533 if (!(quest[i].flags & QUEST_FLAG_SILENT))
536 msg_print("¥¯¥¨¥¹¥È¤òãÀ®¤·¤¿¡ª");
538 msg_print("You just completed your quest!");
544 /* Finish the two main quests without rewarding */
545 if ((i == QUEST_OBERON) || (i == QUEST_SERPENT))
547 quest[i].status = QUEST_STATUS_FINISHED;
550 if (quest[i].type == QUEST_TYPE_RANDOM)
553 quest[i].status = QUEST_STATUS_FINISHED;
558 case QUEST_TYPE_KILL_ANY_LEVEL:
561 if (quest[i].cur_num >= quest[i].max_num)
563 if (record_fix_quest) do_cmd_write_nikki(NIKKI_FIX_QUEST_C, i, NULL);
564 /* completed quest */
565 quest[i].status = QUEST_STATUS_COMPLETED;
566 quest[i].complev = (byte)p_ptr->lev;
568 if (!(quest[i].flags & QUEST_FLAG_SILENT))
571 msg_print("¥¯¥¨¥¹¥È¤òãÀ®¤·¤¿¡ª");
573 msg_print("You just completed your quest!");
578 quest[i].cur_num = 0;
585 /* Create a magical staircase */
589 while (cave_perma_bold(y, x) || cave[y][x].o_idx || (cave[y][x].info & CAVE_OBJECT) )
591 /* Pick a location */
592 scatter(&ny, &nx, y, x, 1, 0);
598 /* Explain the staircase */
600 msg_print("ËâË¡¤Î³¬Ãʤ¬¸½¤ì¤¿...");
602 msg_print("A magical staircase appears...");
606 /* Create stairs down */
607 cave_set_feat(y, x, FEAT_MORE);
609 /* Remember to update everything */
610 p_ptr->update |= (PU_FLOW);
618 for (j = 0; j < (dun_level / 15)+1; j++)
620 /* Get local object */
623 /* Wipe the object */
626 /* Make a great object */
627 make_object(q_ptr, AM_GOOD | AM_GREAT);
629 /* Drop it in the dungeon */
630 (void)drop_near(q_ptr, -1, y, x);
637 * Return monster death string
639 cptr extract_note_dies(monster_race *r_ptr)
641 /* Some monsters get "destroyed" */
642 if (!monster_living(r_ptr))
646 for (i = 0; i < 4; i++)
648 if (r_ptr->blow[i].method == RBM_EXPLODE)
651 return "¤ÏÇúȯ¤·¤ÆÊ´¡¹¤Ë¤Ê¤Ã¤¿¡£";
653 return " explodes into tiny shreds.";
661 return " is destroyed.";
665 /* Assume a default death */
675 * Handle the "death" of a monster.
677 * Disperse treasures centered at the monster location based on the
678 * various flags contained in the monster flags fields.
680 * Check for "Quest" completion when a quest monster is killed.
682 * Note that only the player can induce "monster_death()" on Uniques.
683 * Thus (for now) all Quest monsters should be Uniques.
685 * Note that monsters can now carry objects, and when a monster dies,
686 * it drops all of its objects, which may disappear in crowded rooms.
688 void monster_death(int m_idx, bool drop_item)
697 monster_type *m_ptr = &m_list[m_idx];
699 monster_race *r_ptr = &r_info[m_ptr->r_idx];
701 bool visible = (m_ptr->ml || (r_ptr->flags1 & RF1_UNIQUE));
705 bool do_gold = (!(r_ptr->flags1 & RF1_ONLY_ITEM));
706 bool do_item = (!(r_ptr->flags1 & RF1_ONLY_GOLD));
707 bool cloned = (m_ptr->smart & SM_CLONED) ? TRUE : FALSE;
708 int force_coin = get_coin_type(m_ptr->r_idx);
713 bool drop_chosen_item = drop_item && !cloned && !p_ptr->inside_arena
714 && !p_ptr->inside_battle && !is_pet(m_ptr);
716 /* The caster is dead? */
717 if (world_monster && world_monster == m_idx) world_monster = 0;
719 /* Notice changes in view */
720 if (r_ptr->flags7 & (RF7_LITE_MASK | RF7_DARK_MASK))
722 /* Update some things */
723 p_ptr->update |= (PU_MON_LITE);
726 /* Get the location */
730 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
734 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
735 do_cmd_write_nikki(NIKKI_NAMED_PET, 3, m_name);
738 /* Let monsters explode! */
739 for (i = 0; i < 4; i++)
741 if (r_ptr->blow[i].method == RBM_EXPLODE)
743 int flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
744 int typ = mbe_info[r_ptr->blow[i].effect].explode_type;
745 int d_dice = r_ptr->blow[i].d_dice;
746 int d_side = r_ptr->blow[i].d_side;
747 int damage = damroll(d_dice, d_side);
749 project(m_idx, 3, y, x, damage, typ, flg, -1);
754 if (m_ptr->mflag2 & MFLAG2_CHAMELEON)
756 choose_new_monster(m_idx, TRUE, MON_CHAMELEON);
757 r_ptr = &r_info[m_ptr->r_idx];
760 /* Check for quest completion */
761 check_quest_completion(m_ptr);
763 /* Handle the possibility of player vanquishing arena combatant -KMW- */
764 if (p_ptr->inside_arena && !is_pet(m_ptr))
766 p_ptr->exit_bldg = TRUE;
768 if (p_ptr->arena_number > MAX_ARENA_MONS)
771 msg_print("ÁÇÀ²¤é¤·¤¤¡ª·¯¤³¤½¿¿¤Î¾¡Íø¼Ô¤À¡£");
773 msg_print("You are a Genuine Champion!");
779 msg_print("¾¡Íø¡ª¥Á¥ã¥ó¥Ô¥ª¥ó¤Ø¤ÎÆ»¤ò¿Ê¤ó¤Ç¤¤¤ë¡£");
781 msg_print("Victorious! You're on your way to becoming Champion.");
785 if (arena_info[p_ptr->arena_number].tval)
787 /* Get local object */
790 /* Prepare to make a prize */
791 object_prep(q_ptr, lookup_kind(arena_info[p_ptr->arena_number].tval, arena_info[p_ptr->arena_number].sval));
793 apply_magic(q_ptr, object_level, AM_NO_FIXED_ART);
795 /* Drop it in the dungeon */
796 (void)drop_near(q_ptr, -1, y, x);
799 if (p_ptr->arena_number > MAX_ARENA_MONS) p_ptr->arena_number++;
800 p_ptr->arena_number++;
805 /* Extract monster name */
806 monster_desc(m_name, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
808 do_cmd_write_nikki(NIKKI_ARENA, p_ptr->arena_number, m_name);
812 if (m_idx == p_ptr->riding)
814 if (rakuba(-1, FALSE))
817 msg_print("ÃÏÌ̤ËÍî¤È¤µ¤ì¤¿¡£");
819 msg_print("You have fallen from your riding pet.");
824 /* Drop a dead corpse? */
825 if (one_in_(r_ptr->flags1 & RF1_UNIQUE ? 1 : 4) &&
826 ((r_ptr->flags9 & RF9_DROP_CORPSE) ||
827 (r_ptr->flags9 & RF9_DROP_SKELETON)) &&
828 !(p_ptr->inside_arena || p_ptr->inside_battle || cloned || ((m_ptr->r_idx == today_mon) && is_pet(m_ptr))))
830 /* Assume skeleton */
834 * We cannot drop a skeleton? Note, if we are in this check,
835 * we *know* we can drop at least a corpse or a skeleton
837 if (!(r_ptr->flags9 & RF9_DROP_SKELETON))
839 else if ((r_ptr->flags9 & RF9_DROP_CORPSE) && (r_ptr->flags1 && RF1_UNIQUE))
842 /* Else, a corpse is more likely unless we did a "lot" of damage */
843 else if (r_ptr->flags9 & RF9_DROP_CORPSE)
845 /* Lots of damage in one blow */
846 if ((0 - ((m_ptr->maxhp) / 4)) > m_ptr->hp)
848 if (one_in_(5)) corpse = TRUE;
852 if (!one_in_(5)) corpse = TRUE;
856 /* Get local object */
859 /* Prepare to make an object */
860 object_prep(q_ptr, lookup_kind(TV_CORPSE, (corpse ? SV_CORPSE : SV_SKELETON)));
862 apply_magic(q_ptr, object_level, AM_NO_FIXED_ART);
864 q_ptr->pval = m_ptr->r_idx;
866 /* Drop it in the dungeon */
867 (void)drop_near(q_ptr, -1, y, x);
870 /* Drop objects being carried */
871 monster_drop_carried_objects(m_ptr);
873 if (r_ptr->flags1 & RF1_DROP_GOOD) mo_mode |= AM_GOOD;
874 if (r_ptr->flags1 & RF1_DROP_GREAT) mo_mode |= AM_GREAT;
876 switch (m_ptr->r_idx)
878 case MON_PINK_HORROR:
879 /* Pink horrors are replaced with 2 Blue horrors */
880 if (!(p_ptr->inside_arena || p_ptr->inside_battle))
884 for (i = 0; i < 2; i++)
887 bool pet = is_pet(m_ptr);
890 if (pet) mode |= PM_FORCE_PET;
892 if (summon_specific((pet ? -1 : m_idx), wy, wx, 100, SUMMON_BLUE_HORROR, mode))
894 if (player_can_see_bold(wy, wx))
901 msg_print("¥Ô¥ó¥¯¡¦¥Û¥é¡¼¤ÏʬÎö¤·¤¿¡ª");
903 msg_print("The Pink horror divides!");
908 case MON_BLOODLETTER:
909 /* Bloodletters of Khorne may drop a blade of chaos */
910 if (drop_chosen_item && (randint1(100) < 15))
912 /* Get local object */
915 /* Prepare to make a Blade of Chaos */
916 object_prep(q_ptr, lookup_kind(TV_SWORD, SV_BLADE_OF_CHAOS));
918 apply_magic(q_ptr, object_level, AM_NO_FIXED_ART | mo_mode);
920 /* Drop it in the dungeon */
921 (void)drop_near(q_ptr, -1, y, x);
926 if (drop_chosen_item && (dun_level > 9))
928 /* Get local object */
931 /* Wipe the object */
934 /* Activate restriction */
935 if ((dun_level > 49) && one_in_(5))
936 get_obj_num_hook = kind_is_good_book;
938 get_obj_num_hook = kind_is_book;
941 make_object(q_ptr, mo_mode);
943 /* Drop it in the dungeon */
944 (void)drop_near(q_ptr, -1, y, x);
950 * Mega^3-hack: killing a 'Warrior of the Dawn' is likely to
951 * spawn another in the fallen one's place!
953 if (!p_ptr->inside_arena && !p_ptr->inside_battle)
959 bool pet = is_pet(m_ptr);
963 scatter(&wy, &wx, y, x, 20, 0);
965 while (!(in_bounds(wy, wx) && cave_empty_bold2(wy, wx)) && --attempts);
970 if (pet) mode |= PM_FORCE_PET;
972 if (summon_specific((pet ? -1 : m_idx), wy, wx, 100, SUMMON_DAWN, mode))
974 if (player_can_see_bold(wy, wx))
976 msg_print("¿·¤¿¤ÊÀï»Î¤¬¸½¤ì¤¿¡ª");
978 msg_print("A new warrior steps forth!");
988 /* One more ultra-hack: An Unmaker goes out with a big bang! */
990 int flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
991 (void)project(m_idx, 6, y, x, 100, GF_CHAOS, flg, -1);
995 case MON_UNICORN_ORD:
998 /* Reward for "lazy" player */
999 if (p_ptr->pseikaku == SEIKAKU_NAMAKE)
1003 if (!drop_chosen_item) break;
1007 switch (randint0(3))
1010 a_idx = ART_NAMAKE_HAMMER;
1013 a_idx = ART_NAMAKE_BOW;
1016 a_idx = ART_NAMAKE_ARMOR;
1020 while (a_info[a_idx].cur_num);
1022 if (a_info[a_idx].cur_num == 0)
1024 /* Create the artifact */
1025 create_named_art(a_idx, y, x);
1026 a_info[a_idx].cur_num = 1;
1032 if (!drop_chosen_item) break;
1034 /* Get local object */
1037 /* Mega-Hack -- Prepare to make "Grond" */
1038 object_prep(q_ptr, lookup_kind(TV_HAFTED, SV_GROND));
1040 /* Mega-Hack -- Mark this item as "Grond" */
1041 q_ptr->name1 = ART_GROND;
1043 /* Mega-Hack -- Actually create "Grond" */
1044 apply_magic(q_ptr, -1, AM_GOOD | AM_GREAT);
1046 /* Drop it in the dungeon */
1047 (void)drop_near(q_ptr, -1, y, x);
1049 /* Get local object */
1052 /* Mega-Hack -- Prepare to make "Chaos" */
1053 object_prep(q_ptr, lookup_kind(TV_CROWN, SV_CHAOS));
1055 /* Mega-Hack -- Mark this item as "Chaos" */
1056 q_ptr->name1 = ART_CHAOS;
1058 /* Mega-Hack -- Actually create "Chaos" */
1059 apply_magic(q_ptr, -1, AM_GOOD | AM_GREAT);
1061 /* Drop it in the dungeon */
1062 (void)drop_near(q_ptr, -1, y, x);
1065 case MON_B_DEATH_SWORD:
1066 if (drop_chosen_item)
1068 /* Get local object */
1071 /* Prepare to make a broken sword */
1072 object_prep(q_ptr, lookup_kind(TV_SWORD, randint1(2)));
1074 /* Drop it in the dungeon */
1075 (void)drop_near(q_ptr, -1, y, x);
1081 if (drop_chosen_item && ((m_ptr->r_idx == MON_A_GOLD) ||
1082 ((m_ptr->r_idx == MON_A_SILVER) && (r_ptr->r_pkills % 5 == 0))))
1084 /* Get local object */
1087 /* Prepare to make a Can of Toys */
1088 object_prep(q_ptr, lookup_kind(TV_CHEST, SV_CHEST_KANDUME));
1090 apply_magic(q_ptr, object_level, AM_NO_FIXED_ART);
1092 /* Drop it in the dungeon */
1093 (void)drop_near(q_ptr, -1, y, x);
1099 int flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
1100 (void)project(m_idx, 3, y, x, damroll(20, 10), GF_FIRE, flg, -1);
1105 if (!drop_chosen_item) break;
1107 switch (r_ptr->d_char)
1112 /* Get local object */
1115 /* Wipe the object */
1118 /* Activate restriction */
1119 get_obj_num_hook = kind_is_cloak;
1122 make_object(q_ptr, mo_mode);
1124 /* Drop it in the dungeon */
1125 (void)drop_near(q_ptr, -1, y, x);
1132 /* Get local object */
1135 /* Wipe the object */
1138 /* Activate restriction */
1139 get_obj_num_hook = kind_is_polearm;
1141 /* Make a poleweapon */
1142 make_object(q_ptr, mo_mode);
1144 /* Drop it in the dungeon */
1145 (void)drop_near(q_ptr, -1, y, x);
1152 /* Get local object */
1155 /* Wipe the object */
1158 /* Activate restriction */
1159 get_obj_num_hook = kind_is_armor;
1161 /* Make a hard armor */
1162 make_object(q_ptr, mo_mode);
1164 /* Drop it in the dungeon */
1165 (void)drop_near(q_ptr, -1, y, x);
1172 /* Get local object */
1175 /* Wipe the object */
1178 /* Activate restriction */
1179 get_obj_num_hook = kind_is_hafted;
1181 /* Make a poleweapon */
1182 make_object(q_ptr, mo_mode);
1184 /* Drop it in the dungeon */
1185 (void)drop_near(q_ptr, -1, y, x);
1190 if (m_ptr->r_idx != MON_STORMBRINGER)
1192 /* Get local object */
1195 /* Wipe the object */
1198 /* Activate restriction */
1199 get_obj_num_hook = kind_is_sword;
1202 make_object(q_ptr, mo_mode);
1204 /* Drop it in the dungeon */
1205 (void)drop_near(q_ptr, -1, y, x);
1212 /* Mega-Hack -- drop fixed items */
1213 if (drop_chosen_item)
1218 switch (m_ptr->r_idx)
1238 case MON_STORMBRINGER:
1239 a_idx = ART_STORMBRINGER;
1244 a_idx = ART_CRIMSON;
1254 a_idx = ART_KUSANAGI;
1284 a_idx = ART_WEREWINDLE;
1292 a_idx = ART_GRAYSWANDIR;
1303 a_idx = ART_TWILIGHT;
1308 a_idx = ART_ELENDIL;
1323 a_idx = ART_DESTINY;
1328 a_idx = ART_ZANTETSU;
1343 a_idx = ART_WINBLOWS;
1347 case MON_LUNGORTHIN:
1352 case MON_JACK_SHADOWS:
1358 a_idx = ART_STONEMASK;
1363 a_idx = ART_SOULCRUSH;
1368 a_idx = ART_EXCALIBUR_J;
1373 a_idx = ART_SHUTEN_DOJI;
1378 a_idx = ART_GOTHMOG;
1388 if ((a_idx > 0) && ((randint0(100) < chance) || p_ptr->wizard))
1390 if (a_info[a_idx].cur_num == 0)
1392 /* Create the artifact */
1393 create_named_art(a_idx, y, x);
1394 a_info[a_idx].cur_num = 1;
1398 if ((r_ptr->flags7 & RF7_GUARDIAN) && (d_info[dungeon_type].final_guardian == m_ptr->r_idx))
1400 int k_idx = d_info[dungeon_type].final_object ? d_info[dungeon_type].final_object
1401 : lookup_kind(TV_SCROLL, SV_SCROLL_ACQUIREMENT);
1403 if (d_info[dungeon_type].final_artifact)
1405 int a_idx = d_info[dungeon_type].final_artifact;
1406 if (!a_info[a_idx].cur_num)
1408 /* Create the artifact */
1409 create_named_art(a_idx, y, x);
1410 a_info[a_idx].cur_num = 1;
1412 /* Prevent rewarding both artifact and "default" object */
1413 if (!d_info[dungeon_type].final_object) k_idx = 0;
1419 /* Get local object */
1422 /* Prepare to make a reward */
1423 object_prep(q_ptr, k_idx);
1425 apply_magic(q_ptr, object_level, AM_NO_FIXED_ART | AM_GOOD);
1427 /* Drop it in the dungeon */
1428 (void)drop_near(q_ptr, -1, y, x);
1431 msg_format("¤¢¤Ê¤¿¤Ï%s¤òÀ©ÇƤ·¤¿¡ª",d_name+d_info[dungeon_type].name);
1433 msg_format("You have conquered %s!",d_name+d_info[dungeon_type].name);
1438 /* Determine how much we can drop */
1439 if ((r_ptr->flags1 & RF1_DROP_60) && (randint0(100) < 60)) number++;
1440 if ((r_ptr->flags1 & RF1_DROP_90) && (randint0(100) < 90)) number++;
1441 if (r_ptr->flags1 & RF1_DROP_1D2) number += damroll(1, 2);
1442 if (r_ptr->flags1 & RF1_DROP_2D2) number += damroll(2, 2);
1443 if (r_ptr->flags1 & RF1_DROP_3D2) number += damroll(3, 2);
1444 if (r_ptr->flags1 & RF1_DROP_4D2) number += damroll(4, 2);
1446 if (cloned && !(r_ptr->flags1 & RF1_UNIQUE))
1447 number = 0; /* Clones drop no stuff unless Cloning Pits */
1449 if (is_pet(m_ptr) || p_ptr->inside_battle || p_ptr->inside_arena)
1450 number = 0; /* Pets drop no stuff */
1451 if (!drop_item && (r_ptr->d_char != '$')) number = 0;
1453 /* Hack -- handle creeping coins */
1454 coin_type = force_coin;
1456 /* Average dungeon and monster levels */
1457 object_level = (dun_level + r_ptr->level) / 2;
1459 /* Drop some objects */
1460 for (j = 0; j < number; j++)
1462 /* Get local object */
1465 /* Wipe the object */
1469 if (do_gold && (!do_item || (randint0(100) < 50)))
1471 /* Make some gold */
1472 if (!make_gold(q_ptr)) continue;
1481 /* Make an object */
1482 if (!make_object(q_ptr, mo_mode)) continue;
1488 /* Drop it in the dungeon */
1489 (void)drop_near(q_ptr, -1, y, x);
1492 /* Reset the object level */
1493 object_level = base_level;
1495 /* Reset "coin" type */
1499 /* Take note of any dropped treasure */
1500 if (visible && (dump_item || dump_gold))
1502 /* Take notes on treasure */
1503 lore_treasure(m_idx, dump_item, dump_gold);
1506 /* Only process "Quest Monsters" */
1507 if (!(r_ptr->flags1 & RF1_QUESTOR)) return;
1508 if (p_ptr->inside_battle) return;
1511 if ((m_ptr->r_idx == MON_SERPENT) && !cloned)
1514 p_ptr->total_winner = TRUE;
1516 /* Redraw the "title" */
1517 p_ptr->redraw |= (PR_TITLE);
1520 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "¸«»ö¤ËÊѶòÈÚÅܤξ¡Íø¼Ô¤È¤Ê¤Ã¤¿¡ª");
1522 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "become *WINNER* of Hengband finely!");
1525 if ((p_ptr->pclass == CLASS_CHAOS_WARRIOR) || (p_ptr->muta2 & MUT2_CHAOS_GIFT))
1528 msg_format("%s¤«¤é¤ÎÀ¼¤¬¶Á¤¤¤¿¡£", chaos_patrons[p_ptr->chaos_patron]);
1529 msg_print("¡Ø¤è¤¯¤ä¤Ã¤¿¡¢ÄêÌ¿¤Î¼Ô¤è¡ª¡Ù");
1531 msg_format("The voice of %s booms out:", chaos_patrons[p_ptr->chaos_patron]);
1532 msg_print("'Thou art donst well, mortal!'");
1536 /* Congratulations */
1538 msg_print("*** ¤ª¤á¤Ç¤È¤¦ ***");
1540 msg_print("*** CONGRATULATIONS ***");
1544 msg_print("¤¢¤Ê¤¿¤Ï¥²¡¼¥à¤ò¥³¥ó¥×¥ê¡¼¥È¤·¤Þ¤·¤¿¡£");
1546 msg_print("You have won the game!");
1550 msg_print("½àÈ÷¤¬À°¤Ã¤¿¤é°úÂà(¼«»¦¥³¥Þ¥ó¥É)¤·¤Æ¤â·ë¹½¤Ç¤¹¡£");
1552 msg_print("You may retire (commit suicide) when you are ready.");
1558 * Modify the physical damage done to the monster.
1559 * (for example when it's invulnerable or shielded)
1561 * ToDo: Accept a damage-type to calculate the modified damage from
1562 * things like fire, frost, lightning, poison, ... attacks.
1564 * "type" is not yet used and should be 0.
1566 int mon_damage_mod(monster_type *m_ptr, int dam, bool is_psy_spear)
1568 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1570 if ((r_ptr->flagsr & RFR_RES_ALL) && dam > 0)
1573 if((dam == 0) && one_in_(3)) dam = 1;
1576 if (m_ptr->invulner)
1580 if (!p_ptr->blind && is_seen(m_ptr))
1583 msg_print("¥Ð¥ê¥¢¤òÀÚ¤êÎö¤¤¤¿¡ª");
1585 msg_print("The barrier is penetrated!");
1589 else if (!one_in_(PENETRATE_INVULNERABILITY))
1599 * Calculate experience point to be get
1601 * Even the 64 bit operation is not big enough to avoid overflaw
1602 * unless we carefully choose orders of multiplication and division.
1604 * Get the coefficient first, and multiply (potentially huge) base
1605 * experience point of a monster later.
1607 static void get_exp_from_mon(int dam, monster_type *m_ptr)
1609 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1616 if (!m_ptr->r_idx) return;
1617 if (is_pet(m_ptr) || p_ptr->inside_battle) return;
1620 * - Ratio of monster's level to player's level effects
1621 * - Varying speed effects
1622 * - Get a fraction in proportion of damage point
1624 new_exp = r_ptr->level * SPEED_TO_ENERGY(m_ptr->mspeed) * dam;
1627 div_l = (p_ptr->max_plv+2) * SPEED_TO_ENERGY(r_ptr->speed);
1629 /* Use (average maxhp * 2) as a denominator */
1630 if (!(r_ptr->flags1 & RF1_FORCE_MAXHP))
1631 s64b_mul(&div_h, &div_l, 0, r_ptr->hdice * (r_ptr->hside + 1));
1633 s64b_mul(&div_h, &div_l, 0, r_ptr->hdice * r_ptr->hside * 2);
1635 /* Special penalty in the wilderness */
1636 if (!dun_level && (!(r_ptr->flags8 & RF8_WILD_ONLY) || !(r_ptr->flags1 & RF1_UNIQUE)))
1637 s64b_mul(&div_h, &div_l, 0, 5);
1639 /* Do division first to prevent overflaw */
1640 s64b_div(&new_exp, &new_exp_frac, div_h, div_l);
1642 /* Special penalty for mutiply-monster */
1643 if ((r_ptr->flags2 & RF2_MULTIPLY) || (m_ptr->r_idx == MON_DAWN))
1645 int monnum_penarty = r_ptr->r_pkills / 400;
1646 if (monnum_penarty > 8) monnum_penarty = 8;
1648 while (monnum_penarty--)
1651 s64b_RSHIFT(new_exp, new_exp_frac, 2);
1655 /* Finally multiply base experience point of the monster */
1656 s64b_mul(&new_exp, &new_exp_frac, 0, r_ptr->mexp);
1658 /* Gain experience */
1659 gain_exp_64(new_exp, new_exp_frac);
1664 * Decreases monsters hit points, handling monster death.
1666 * We return TRUE if the monster has been killed (and deleted).
1668 * We announce monster death (using an optional "death message"
1669 * if given, and a otherwise a generic killed/destroyed message).
1671 * Only "physical attacks" can induce the "You have slain" message.
1672 * Missile and Spell attacks will induce the "dies" message, or
1673 * various "specialized" messages. Note that "You have destroyed"
1674 * and "is destroyed" are synonyms for "You have slain" and "dies".
1676 * Hack -- unseen monsters yield "You have killed it." message.
1678 * Added fear (DGK) and check whether to print fear messages -CWS
1680 * Made name, sex, and capitalization generic -BEN-
1682 * As always, the "ghost" processing is a total hack.
1684 * Hack -- we "delay" fear messages by passing around a "fear" flag.
1686 * XXX XXX XXX Consider decreasing monster experience over time, say,
1687 * by using "(m_exp * m_lev * (m_lev)) / (p_lev * (m_lev + n_killed))"
1688 * instead of simply "(m_exp * m_lev) / (p_lev)", to make the first
1689 * monster worth more than subsequent monsters. This would also need
1690 * to induce changes in the monster recall code.
1692 bool mon_take_hit(int m_idx, int dam, bool *fear, cptr note)
1694 monster_type *m_ptr = &m_list[m_idx];
1695 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1697 monster_type exp_mon;
1699 /* Innocent until proven otherwise */
1700 bool innocent = TRUE, thief = FALSE;
1704 COPY(&exp_mon, m_ptr, monster_type);
1705 if (!(r_ptr->flags7 & RF7_KILL_EXP))
1707 expdam = (m_ptr->hp > dam) ? dam : m_ptr->hp;
1708 if (r_ptr->flags6 & RF6_HEAL) expdam = (expdam+1) * 2 / 3;
1710 get_exp_from_mon(expdam, &exp_mon);
1713 /* Redraw (later) if needed */
1714 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1715 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
1720 if (r_ptr->flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
1722 /* Hack - Cancel any special player stealth magics. -LM- */
1723 if (p_ptr->special_defense & NINJA_S_STEALTH)
1725 set_superstealth(FALSE);
1731 /* It is dead now */
1736 if (r_info[m_ptr->r_idx].flags7 & RF7_TANUKI)
1738 /* You might have unmasked Tanuki first time */
1739 r_ptr = &r_info[m_ptr->r_idx];
1740 m_ptr->ap_r_idx = m_ptr->r_idx;
1741 if (r_ptr->r_sights < MAX_SHORT) r_ptr->r_sights++;
1744 if (m_ptr->mflag2 & MFLAG2_CHAMELEON)
1746 /* You might have unmasked Chameleon first time */
1747 r_ptr = real_r_ptr(m_ptr);
1748 if (r_ptr->r_sights < MAX_SHORT) r_ptr->r_sights++;
1751 if (!(m_ptr->smart & SM_CLONED))
1753 /* When the player kills a Unique, it stays dead */
1754 if (r_ptr->flags1 & RF1_UNIQUE)
1758 /* Mega-Hack -- Banor & Lupart */
1759 if ((m_ptr->r_idx == MON_BANOR) || (m_ptr->r_idx == MON_LUPART))
1761 r_info[MON_BANORLUPART].max_num = 0;
1762 r_info[MON_BANORLUPART].r_pkills++;
1763 if (r_info[MON_BANORLUPART].r_tkills < MAX_SHORT) r_info[MON_BANORLUPART].r_tkills++;
1765 else if (m_ptr->r_idx == MON_BANORLUPART)
1767 r_info[MON_BANOR].max_num = 0;
1768 r_info[MON_BANOR].r_pkills++;
1769 if (r_info[MON_BANOR].r_tkills < MAX_SHORT) r_info[MON_BANOR].r_tkills++;
1770 r_info[MON_LUPART].max_num = 0;
1771 r_info[MON_LUPART].r_pkills++;
1772 if (r_info[MON_LUPART].r_tkills < MAX_SHORT) r_info[MON_LUPART].r_tkills++;
1776 /* When the player kills a Nazgul, it stays dead */
1777 else if (r_ptr->flags7 & RF7_NAZGUL) r_ptr->max_num--;
1780 /* Recall even invisible uniques or winners */
1781 if (m_ptr->ml || (r_ptr->flags1 & RF1_UNIQUE))
1783 /* Count kills this life */
1784 if ((m_ptr->mflag2 & MFLAG2_KAGE) && (r_info[MON_KAGE].r_pkills < MAX_SHORT)) r_info[MON_KAGE].r_pkills++;
1785 else if (r_ptr->r_pkills < MAX_SHORT) r_ptr->r_pkills++;
1787 /* Count kills in all lives */
1788 if ((m_ptr->mflag2 & MFLAG2_KAGE) && (r_info[MON_KAGE].r_tkills < MAX_SHORT)) r_info[MON_KAGE].r_tkills++;
1789 else if (r_ptr->r_tkills < MAX_SHORT) r_ptr->r_tkills++;
1791 /* Hack -- Auto-recall */
1792 monster_race_track(m_ptr->ap_r_idx);
1795 /* Extract monster name */
1796 monster_desc(m_name, m_ptr, MD_TRUE_NAME);
1798 /* Don't kill Amberites */
1799 if ((r_ptr->flags3 & RF3_AMBERITE) && one_in_(2))
1801 int curses = 1 + randint1(3);
1802 bool stop_ty = FALSE;
1806 msg_format("%^s¤Ï¶²¤í¤·¤¤·ì¤Î¼ö¤¤¤ò¤¢¤Ê¤¿¤Ë¤«¤±¤¿¡ª", m_name);
1808 msg_format("%^s puts a terrible blood curse on you!", m_name);
1811 curse_equipment(100, 50);
1815 stop_ty = activate_ty_curse(stop_ty, &count);
1820 if (r_ptr->flags2 & RF2_CAN_SPEAK)
1822 char line_got[1024];
1824 /* Dump a message */
1826 if (!get_rnd_line("mondeath_j.txt", m_ptr->r_idx, line_got))
1828 if (!get_rnd_line("mondeath.txt", m_ptr->r_idx, line_got))
1831 msg_format("%^s %s", m_name, line_got);
1834 if (m_ptr->r_idx == MON_SERPENT)
1836 /* Make screen dump */
1837 screen_dump = make_screen_dump();
1842 if (!(d_info[dungeon_type].flags1 & DF1_BEGINNER))
1844 if (!dun_level && !ambush_flag && !p_ptr->inside_arena)
1846 chg_virtue(V_VALOUR, -1);
1848 else if (r_ptr->level > dun_level)
1850 if (randint1(10) <= (r_ptr->level - dun_level))
1851 chg_virtue(V_VALOUR, 1);
1853 if (r_ptr->level > 60)
1855 chg_virtue(V_VALOUR, 1);
1857 if (r_ptr->level >= 2 * (p_ptr->lev+1))
1858 chg_virtue(V_VALOUR, 2);
1861 if (r_ptr->flags1 & RF1_UNIQUE)
1863 if (r_ptr->flags3 & (RF3_EVIL | RF3_GOOD)) chg_virtue(V_HARMONY, 2);
1865 if (r_ptr->flags3 & RF3_GOOD)
1867 chg_virtue(V_UNLIFE, 2);
1868 chg_virtue(V_VITALITY, -2);
1871 if (one_in_(3)) chg_virtue(V_INDIVIDUALISM, -1);
1874 if (m_ptr->r_idx == MON_BEGGAR || m_ptr->r_idx == MON_LEPER)
1876 chg_virtue(V_COMPASSION, -1);
1879 if ((r_ptr->flags3 & RF3_GOOD) &&
1880 ((r_ptr->level) / 10 + (3 * dun_level) >= randint1(100)))
1881 chg_virtue(V_UNLIFE, 1);
1883 if (r_ptr->d_char == 'A')
1885 if (r_ptr->flags1 & RF1_UNIQUE)
1886 chg_virtue(V_FAITH, -2);
1887 else if ((r_ptr->level) / 10 + (3 * dun_level) >= randint1(100))
1889 if (r_ptr->flags3 & RF3_GOOD) chg_virtue(V_FAITH, -1);
1890 else chg_virtue(V_FAITH, 1);
1893 else if (r_ptr->flags3 & RF3_DEMON)
1895 if (r_ptr->flags1 & RF1_UNIQUE)
1896 chg_virtue(V_FAITH, 2);
1897 else if ((r_ptr->level) / 10 + (3 * dun_level) >= randint1(100))
1898 chg_virtue(V_FAITH, 1);
1901 if ((r_ptr->flags3 & RF3_UNDEAD) && (r_ptr->flags1 & RF1_UNIQUE))
1902 chg_virtue(V_VITALITY, 2);
1904 if (r_ptr->r_deaths)
1906 if (r_ptr->flags1 & RF1_UNIQUE)
1908 chg_virtue(V_HONOUR, 10);
1910 else if ((r_ptr->level) / 10 + (2 * dun_level) >= randint1(100))
1912 chg_virtue(V_HONOUR, 1);
1915 if ((r_ptr->flags2 & RF2_MULTIPLY) && (r_ptr->r_pkills > 1000) && one_in_(10))
1917 chg_virtue(V_VALOUR, -1);
1920 for (i = 0; i < 4; i++)
1922 if (r_ptr->blow[i].d_dice != 0) innocent = FALSE; /* Murderer! */
1924 if ((r_ptr->blow[i].effect == RBE_EAT_ITEM)
1925 || (r_ptr->blow[i].effect == RBE_EAT_GOLD))
1927 thief = TRUE; /* Thief! */
1930 /* The new law says it is illegal to live in the dungeon */
1931 if (r_ptr->level != 0) innocent = FALSE;
1935 if (r_ptr->flags1 & RF1_UNIQUE)
1936 chg_virtue(V_JUSTICE, 3);
1937 else if (1+((r_ptr->level) / 10 + (2 * dun_level))
1939 chg_virtue(V_JUSTICE, 1);
1943 chg_virtue (V_JUSTICE, -1);
1946 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)))
1948 if (one_in_(4)) chg_virtue(V_NATURE, -1);
1951 if ((r_ptr->flags1 & RF1_UNIQUE) && record_destroy_uniq)
1955 sprintf(note_buf, "%s%s", r_name + r_ptr->name, (m_ptr->smart & SM_CLONED) ? "(¥¯¥í¡¼¥ó)" : "");
1957 sprintf(note_buf, "%s%s", r_name + r_ptr->name, (m_ptr->smart & SM_CLONED) ? "(Clone)" : "");
1959 do_cmd_write_nikki(NIKKI_UNIQUE, 0, note_buf);
1965 /* Death by Missile/Spell attack */
1968 msg_format("%^s%s", m_name, note);
1971 /* Death by physical attack -- invisible monster */
1972 else if (!m_ptr->ml)
1975 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
1976 msg_format("¤»¤Ã¤«¤¯¤À¤«¤é%s¤ò»¦¤·¤¿¡£", m_name);
1978 msg_format("%s¤ò»¦¤·¤¿¡£", m_name);
1980 msg_format("You have killed %s.", m_name);
1985 /* Death by Physical attack -- non-living monster */
1986 else if (!monster_living(r_ptr))
1989 bool explode = FALSE;
1991 for (i = 0; i < 4; i++)
1993 if (r_ptr->blow[i].method == RBM_EXPLODE) explode = TRUE;
1996 /* Special note at death */
1999 msg_format("%s¤ÏÇúȯ¤·¤ÆÊ´¡¹¤Ë¤Ê¤Ã¤¿¡£", m_name);
2001 msg_format("%s explodes into tiny shreds.", m_name);
2006 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
2007 msg_format("¤»¤Ã¤«¤¯¤À¤«¤é%s¤òÅݤ·¤¿¡£", m_name);
2009 msg_format("%s¤òÅݤ·¤¿¡£", m_name);
2011 msg_format("You have destroyed %s.", m_name);
2016 /* Death by Physical attack -- living monster */
2020 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
2021 msg_format("¤»¤Ã¤«¤¯¤À¤«¤é%s¤òÁò¤êµî¤Ã¤¿¡£", m_name);
2023 msg_format("%s¤òÁò¤êµî¤Ã¤¿¡£", m_name);
2025 msg_format("You have slain %s.", m_name);
2029 if ((r_ptr->flags1 & RF1_UNIQUE) && !(m_ptr->smart & SM_CLONED) && !vanilla_town)
2031 for (i = 0; i < MAX_KUBI; i++)
2033 if ((kubi_r_idx[i] == m_ptr->r_idx) && !(m_ptr->mflag2 & MFLAG2_CHAMELEON))
2036 msg_format("%s¤Î¼ó¤Ë¤Ï¾Þ¶â¤¬¤«¤«¤Ã¤Æ¤¤¤ë¡£", m_name);
2038 msg_format("There is a price on %s's head.", m_name);
2045 /* Generate treasure */
2046 monster_death(m_idx, TRUE);
2048 /* Mega hack : replace IKETA to BIKETAL */
2049 if ((m_ptr->r_idx == MON_IKETA) &&
2050 !(p_ptr->inside_arena || p_ptr->inside_battle))
2052 int dummy_y = m_ptr->fy;
2053 int dummy_x = m_ptr->fx;
2056 if (is_pet(m_ptr)) mode |= PM_FORCE_PET;
2058 /* Delete the monster */
2059 delete_monster_idx(m_idx);
2061 if (summon_named_creature(0, dummy_y, dummy_x, MON_BIKETAL, mode))
2064 msg_print("¡Ö¥Ï¥¡¥Ã¥Ï¥Ã¥Ï¥Ã¥Ï¡ª¡ª»ä¤¬¥Ð¥¤¥±¥¿¥ë¤À¡ª¡ª¡×");
2066 msg_print("Uwa-hahaha! *I* am Biketal!");
2072 /* Delete the monster */
2073 delete_monster_idx(m_idx);
2076 /* Prevent bug of chaos patron's reward */
2077 if (r_ptr->flags7 & RF7_KILL_EXP)
2078 get_exp_from_mon((long)exp_mon.max_maxhp*2, &exp_mon);
2080 get_exp_from_mon(((long)exp_mon.max_maxhp+1L) * 9L / 10L, &exp_mon);
2085 /* Monster is dead */
2092 /* Mega-Hack -- Pain cancels fear */
2093 if (m_ptr->monfear && (dam > 0))
2095 int tmp = randint1(dam);
2097 /* Cure a little fear */
2098 if (tmp < m_ptr->monfear)
2101 m_ptr->monfear -= tmp;
2104 /* Cure all the fear */
2115 /* Sometimes a monster gets scared by damage */
2116 if (!m_ptr->monfear && !(r_ptr->flags3 & (RF3_NO_FEAR)))
2120 /* Percentage of fully healthy */
2121 percentage = (100L * m_ptr->hp) / m_ptr->maxhp;
2124 * Run (sometimes) if at 10% or less of max hit points,
2125 * or (usually) when hit for half its current hit points
2127 if ((randint1(10) >= percentage) ||
2128 ((dam >= m_ptr->hp) && (randint0(100) < 80)))
2130 /* Hack -- note fear */
2133 /* XXX XXX XXX Hack -- Add some timed fear */
2134 m_ptr->monfear = (randint1(10) +
2135 (((dam >= m_ptr->hp) && (percentage > 7)) ?
2136 20 : ((11 - percentage) * 5)));
2143 if (p_ptr->riding && (p_ptr->riding == m_idx) && (dam > 0))
2147 /* Extract monster name */
2148 monster_desc(m_name, m_ptr, 0);
2150 if (m_ptr->hp > m_ptr->maxhp/3) dam = (dam + 1) / 2;
2151 if (rakuba((dam > 200) ? 200 : dam, FALSE))
2154 msg_format("%^s¤Ë¿¶¤êÍî¤È¤µ¤ì¤¿¡ª", m_name);
2156 msg_format("%^s has thrown you off!", m_name);
2168 * Get term size and calculate screen size
2170 void get_screen_size(int *wid_p, int *hgt_p)
2172 Term_get_size(wid_p, hgt_p);
2173 *hgt_p -= ROW_MAP + 2;
2174 *wid_p -= COL_MAP + 2;
2175 if (use_bigtile) *wid_p /= 2;
2180 * Calculates current boundaries
2181 * Called below and from "do_cmd_locate()".
2183 void panel_bounds_center(void)
2188 get_screen_size(&wid, &hgt);
2190 panel_row_max = panel_row_min + hgt - 1;
2191 panel_row_prt = panel_row_min - 1;
2192 panel_col_max = panel_col_min + wid - 1;
2193 panel_col_prt = panel_col_min - 13;
2198 * Map resizing whenever the main term changes size
2200 void resize_map(void)
2202 /* Only if the dungeon exists */
2203 if (!character_dungeon) return;
2205 /* Mega-Hack -- no panel yet */
2209 /* Reset the panels */
2210 panel_row_min = cur_hgt;
2211 panel_col_min = cur_wid;
2216 p_ptr->update |= (PU_TORCH | PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
2218 /* Forget lite/view */
2219 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
2221 /* Update lite/view */
2222 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
2224 /* Update monsters */
2225 p_ptr->update |= (PU_MONSTERS);
2227 /* Redraw everything */
2228 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
2230 /* Hack -- update */
2238 * Place the cursor on the player
2240 if (can_save) move_cursor_relative(py, px);
2247 * Redraw a term when it is resized
2249 void redraw_window(void)
2251 /* Only if the dungeon exists */
2252 if (!character_dungeon) return;
2254 /* Hack - Activate term zero for the redraw */
2255 Term_activate(&term_screen[0]);
2257 /* Hack -- react to changes */
2258 Term_xtra(TERM_XTRA_REACT, 0);
2261 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
2264 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
2266 /* Hack -- update */
2278 * Handle a request to change the current panel
2280 * Return TRUE if the panel was changed.
2282 * Also used in do_cmd_locate
2284 bool change_panel(int dy, int dx)
2290 get_screen_size(&wid, &hgt);
2292 /* Apply the motion */
2293 y = panel_row_min + dy * hgt / 2;
2294 x = panel_col_min + dx * wid / 2;
2296 /* Verify the row */
2297 if (y > cur_hgt - hgt) y = cur_hgt - hgt;
2300 /* Verify the col */
2301 if (x > cur_wid - wid) x = cur_wid - wid;
2304 /* Handle "changes" */
2305 if ((y != panel_row_min) || (x != panel_col_min))
2307 /* Save the new panel info */
2311 /* Recalculate the boundaries */
2312 panel_bounds_center();
2315 p_ptr->update |= (PU_MONSTERS);
2318 p_ptr->redraw |= (PR_MAP);
2333 * Given an row (y) and col (x), this routine detects when a move
2334 * off the screen has occurred and figures new borders. -RAK-
2336 * "Update" forces a "full update" to take place.
2338 * The map is reprinted if necessary, and "TRUE" is returned.
2340 void verify_panel(void)
2352 get_screen_size(&wid, &hgt);
2354 max_prow_min = cur_hgt - hgt;
2355 max_pcol_min = cur_wid - wid;
2357 /* Bounds checking */
2358 if (max_prow_min < 0) max_prow_min = 0;
2359 if (max_pcol_min < 0) max_pcol_min = 0;
2361 /* Center on player */
2362 if (center_player && (center_running || !running))
2364 /* Center vertically */
2365 prow_min = y - hgt / 2;
2366 if (prow_min < 0) prow_min = 0;
2367 else if (prow_min > max_prow_min) prow_min = max_prow_min;
2369 /* Center horizontally */
2370 pcol_min = x - wid / 2;
2371 if (pcol_min < 0) pcol_min = 0;
2372 else if (pcol_min > max_pcol_min) pcol_min = max_pcol_min;
2376 prow_min = panel_row_min;
2377 pcol_min = panel_col_min;
2379 /* Scroll screen when 2 grids from top/bottom edge */
2380 if (y > panel_row_max - 2)
2382 while (y > prow_min + hgt-1 - 2)
2384 prow_min += (hgt / 2);
2388 if (y < panel_row_min + 2)
2390 while (y < prow_min + 2)
2392 prow_min -= (hgt / 2);
2396 if (prow_min > max_prow_min) prow_min = max_prow_min;
2397 if (prow_min < 0) prow_min = 0;
2399 /* Scroll screen when 4 grids from left/right edge */
2400 if (x > panel_col_max - 4)
2402 while (x > pcol_min + wid-1 - 4)
2404 pcol_min += (wid / 2);
2408 if (x < panel_col_min + 4)
2410 while (x < pcol_min + 4)
2412 pcol_min -= (wid / 2);
2416 if (pcol_min > max_pcol_min) pcol_min = max_pcol_min;
2417 if (pcol_min < 0) pcol_min = 0;
2420 /* Check for "no change" */
2421 if ((prow_min == panel_row_min) && (pcol_min == panel_col_min)) return;
2423 /* Save the new panel info */
2424 panel_row_min = prow_min;
2425 panel_col_min = pcol_min;
2427 /* Hack -- optional disturb on "panel change" */
2428 if (disturb_panel && !center_player) disturb(0, 0);
2430 /* Recalculate the boundaries */
2431 panel_bounds_center();
2434 p_ptr->update |= (PU_MONSTERS);
2437 p_ptr->redraw |= (PR_MAP);
2440 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
2445 * Monster health description
2447 cptr look_mon_desc(monster_type *m_ptr, u32b mode)
2449 monster_race *ap_r_ptr = &r_info[m_ptr->ap_r_idx];
2456 /* Determine if the monster is "living" */
2457 living = monster_living(ap_r_ptr);
2459 /* Calculate a health "percentage" */
2460 perc = 100L * m_ptr->hp / m_ptr->maxhp;
2462 /* Healthy monsters */
2463 if (m_ptr->hp >= m_ptr->maxhp)
2467 desc = living ? "̵½ý" : "̵¥À¥á¡¼¥¸";
2469 desc = living ? "unhurt" : "undamaged";
2474 else if (perc >= 60)
2477 desc = living ? "·Ú½ý" : "¾®¥À¥á¡¼¥¸";
2479 desc = living ? "somewhat wounded" : "somewhat damaged";
2484 else if (perc >= 25)
2487 desc = living ? "Éé½ý" : "Ãæ¥À¥á¡¼¥¸";
2489 desc = living ? "wounded" : "damaged";
2494 else if (perc >= 10)
2497 desc = living ? "½Å½ý" : "Âç¥À¥á¡¼¥¸";
2499 desc = living ? "badly wounded" : "badly damaged";
2507 desc = living ? "Ⱦ»àȾÀ¸" : "Åݤ줫¤±";
2509 desc = living ? "almost dead" : "almost destroyed";
2514 /* Need attitude information? */
2517 /* Full information is not needed */
2520 else if (is_pet(m_ptr))
2523 attitude = ", ¥Ú¥Ã¥È";
2528 else if (is_friendly(m_ptr))
2531 attitude = ", ͧ¹¥Åª";
2533 attitude = ", friendly";
2546 /* Clone monster? */
2547 if (m_ptr->smart & SM_CLONED)
2556 /* Display monster's level --- idea borrowed from ToME */
2557 if (ap_r_ptr->r_tkills && !(m_ptr->mflag2 & MFLAG2_KAGE))
2560 return format("¥ì¥Ù¥ë%d, %s%s%s", ap_r_ptr->level, desc, attitude, clone);
2562 return format("Level %d, %s%s%s", ap_r_ptr->level, desc, attitude, clone);
2568 return format("¥ì¥Ù¥ë???, %s%s%s", desc, attitude, clone);
2570 return format("Level ???, %s%s%s", desc, attitude, clone);
2578 * Angband sorting algorithm -- quick sort in place
2580 * Note that the details of the data we are sorting is hidden,
2581 * and we rely on the "ang_sort_comp()" and "ang_sort_swap()"
2582 * function hooks to interact with the data, which is given as
2583 * two pointers, and which may have any user-defined form.
2585 void ang_sort_aux(vptr u, vptr v, int p, int q)
2603 while (!(*ang_sort_comp)(u, v, b, z)) b--;
2606 while (!(*ang_sort_comp)(u, v, z, a)) a++;
2608 /* Done partition */
2612 (*ang_sort_swap)(u, v, a, b);
2618 /* Recurse left side */
2619 ang_sort_aux(u, v, p, b);
2621 /* Recurse right side */
2622 ang_sort_aux(u, v, b+1, q);
2627 * Angband sorting algorithm -- quick sort in place
2629 * Note that the details of the data we are sorting is hidden,
2630 * and we rely on the "ang_sort_comp()" and "ang_sort_swap()"
2631 * function hooks to interact with the data, which is given as
2632 * two pointers, and which may have any user-defined form.
2634 void ang_sort(vptr u, vptr v, int n)
2636 /* Sort the array */
2637 ang_sort_aux(u, v, 0, n-1);
2642 /*** Targeting Code ***/
2646 * Determine is a monster makes a reasonable target
2648 * The concept of "targeting" was stolen from "Morgul" (?)
2650 * The player can target any location, or any "target-able" monster.
2652 * Currently, a monster is "target_able" if it is visible, and if
2653 * the player can hit it with a projection, and the player is not
2654 * hallucinating. This allows use of "use closest target" macros.
2656 * Future versions may restrict the ability to target "trappers"
2657 * and "mimics", but the semantics is a little bit weird.
2659 bool target_able(int m_idx)
2661 monster_type *m_ptr = &m_list[m_idx];
2663 /* Monster must be alive */
2664 if (!m_ptr->r_idx) return (FALSE);
2666 /* Hack -- no targeting hallucinations */
2667 if (p_ptr->image) return (FALSE);
2669 /* Monster must be visible */
2670 if (!m_ptr->ml) return (FALSE);
2672 if (p_ptr->riding && (p_ptr->riding == m_idx)) return (TRUE);
2674 /* Monster must be projectable */
2675 if (!projectable(py, px, m_ptr->fy, m_ptr->fx)) return (FALSE);
2677 /* XXX XXX XXX Hack -- Never target trappers */
2678 /* if (CLEAR_ATTR && (CLEAR_CHAR)) return (FALSE); */
2688 * Update (if necessary) and verify (if possible) the target.
2690 * We return TRUE if the target is "okay" and FALSE otherwise.
2692 bool target_okay(void)
2694 /* Accept stationary targets */
2695 if (target_who < 0) return (TRUE);
2697 /* Check moving targets */
2700 /* Accept reasonable targets */
2701 if (target_able(target_who))
2703 monster_type *m_ptr = &m_list[target_who];
2705 /* Acquire monster location */
2706 target_row = m_ptr->fy;
2707 target_col = m_ptr->fx;
2714 /* Assume no target */
2721 * Sorting hook -- comp function -- by "distance to player"
2723 * We use "u" and "v" to point to arrays of "x" and "y" positions,
2724 * and sort the arrays by double-distance to the player.
2726 static bool ang_sort_comp_distance(vptr u, vptr v, int a, int b)
2728 byte *x = (byte*)(u);
2729 byte *y = (byte*)(v);
2733 /* Absolute distance components */
2734 kx = x[a]; kx -= px; kx = ABS(kx);
2735 ky = y[a]; ky -= py; ky = ABS(ky);
2737 /* Approximate Double Distance to the first point */
2738 da = ((kx > ky) ? (kx + kx + ky) : (ky + ky + kx));
2740 /* Absolute distance components */
2741 kx = x[b]; kx -= px; kx = ABS(kx);
2742 ky = y[b]; ky -= py; ky = ABS(ky);
2744 /* Approximate Double Distance to the first point */
2745 db = ((kx > ky) ? (kx + kx + ky) : (ky + ky + kx));
2747 /* Compare the distances */
2753 * Sorting hook -- swap function -- by "distance to player"
2755 * We use "u" and "v" to point to arrays of "x" and "y" positions,
2756 * and sort the arrays by distance to the player.
2758 static void ang_sort_swap_distance(vptr u, vptr v, int a, int b)
2760 byte *x = (byte*)(u);
2761 byte *y = (byte*)(v);
2779 * Hack -- help "select" a location (see below)
2781 static s16b target_pick(int y1, int x1, int dy, int dx)
2785 int x2, y2, x3, y3, x4, y4;
2787 int b_i = -1, b_v = 9999;
2790 /* Scan the locations */
2791 for (i = 0; i < temp_n; i++)
2797 /* Directed distance */
2801 /* Verify quadrant */
2802 if (dx && (x3 * dx <= 0)) continue;
2803 if (dy && (y3 * dy <= 0)) continue;
2805 /* Absolute distance */
2809 /* Verify quadrant */
2810 if (dy && !dx && (x4 > y4)) continue;
2811 if (dx && !dy && (y4 > x4)) continue;
2813 /* Approximate Double Distance */
2814 v = ((x4 > y4) ? (x4 + x4 + y4) : (y4 + y4 + x4));
2816 /* XXX XXX XXX Penalize location */
2819 if ((b_i >= 0) && (v >= b_v)) continue;
2831 * Hack -- determine if a given location is "interesting"
2833 static bool target_set_accept(int y, int x)
2837 s16b this_o_idx, next_o_idx = 0;
2840 if (!(in_bounds(y, x))) return (FALSE);
2842 /* Player grid is always interesting */
2843 if (player_bold(y, x)) return (TRUE);
2846 /* Handle hallucination */
2847 if (p_ptr->image) return (FALSE);
2850 /* Examine the grid */
2851 c_ptr = &cave[y][x];
2853 /* Visible monsters */
2856 monster_type *m_ptr = &m_list[c_ptr->m_idx];
2858 /* Visible monsters */
2859 if (m_ptr->ml) return (TRUE);
2862 /* Scan all objects in the grid */
2863 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
2867 /* Acquire object */
2868 o_ptr = &o_list[this_o_idx];
2870 /* Acquire next object */
2871 next_o_idx = o_ptr->next_o_idx;
2873 /* Memorized object */
2874 if (o_ptr->marked) return (TRUE);
2877 /* Interesting memorized features */
2878 if (c_ptr->info & (CAVE_MARK))
2880 /* Notice object features */
2881 if (c_ptr->info & CAVE_OBJECT) return (TRUE);
2883 /* Feature code (applying "mimic" field) */
2884 if (have_flag(f_info[get_feat_mimic(c_ptr)].flags, FF_NOTICE)) return TRUE;
2893 * Prepare the "temp" array for "target_set"
2895 * Return the number of target_able monsters in the set.
2897 static void target_set_prepare(int mode)
2901 /* Reset "temp" array */
2904 /* Scan the current panel */
2905 for (y = panel_row_min; y <= panel_row_max; y++)
2907 for (x = panel_col_min; x <= panel_col_max; x++)
2911 /* Require "interesting" contents */
2912 if (!target_set_accept(y, x)) continue;
2914 c_ptr = &cave[y][x];
2916 /* Require target_able monsters for "TARGET_KILL" */
2917 if ((mode & (TARGET_KILL)) && !target_able(c_ptr->m_idx)) continue;
2919 if ((mode & (TARGET_KILL)) && !target_pet && is_pet(&m_list[c_ptr->m_idx])) continue;
2921 /* Save the location */
2928 /* Set the sort hooks */
2929 ang_sort_comp = ang_sort_comp_distance;
2930 ang_sort_swap = ang_sort_swap_distance;
2932 /* Sort the positions */
2933 ang_sort(temp_x, temp_y, temp_n);
2935 if (p_ptr->riding && target_pet && (temp_n > 1) && (mode & (TARGET_KILL)))
2940 temp_y[0] = temp_y[1];
2943 temp_x[0] = temp_x[1];
2950 * Evaluate number of kill needed to gain level
2952 static void evaluate_monster_exp(char *buf, monster_type *m_ptr)
2954 monster_race *ap_r_ptr = &r_info[m_ptr->ap_r_idx];
2956 s32b exp_mon, exp_adv;
2957 u32b exp_mon_frac, exp_adv_frac;
2959 if ((p_ptr->lev >= PY_MAX_LEVEL) || (p_ptr->prace == RACE_ANDROID))
2964 else if (!ap_r_ptr->r_tkills || (m_ptr->mflag2 & MFLAG2_KAGE))
2974 /* The monster's experience point (assuming average monster speed) */
2975 exp_mon = ap_r_ptr->mexp * ap_r_ptr->level;
2977 s64b_div(&exp_mon, &exp_mon_frac, 0, (p_ptr->max_plv + 2));
2980 /* Total experience value for next level */
2981 exp_adv = player_exp[p_ptr->lev -1] * p_ptr->expfact;
2983 s64b_div(&exp_adv, &exp_adv_frac, 0, 100);
2985 /* Experience value need to get */
2986 s64b_sub(&exp_adv, &exp_adv_frac, p_ptr->exp, p_ptr->exp_frac);
2989 /* You need to kill at least one monster to get any experience */
2990 s64b_add(&exp_adv, &exp_adv_frac, exp_mon, exp_mon_frac);
2991 s64b_sub(&exp_adv, &exp_adv_frac, 0, 1);
2993 /* Extract number of monsters needed */
2994 s64b_div(&exp_adv, &exp_adv_frac, exp_mon, exp_mon_frac);
2996 /* If 999 or more monsters needed, only display "999". */
2997 num = MIN(999, exp_adv_frac);
2999 /* Display the number */
3000 sprintf(buf,"%03ld", num);
3005 * Examine a grid, return a keypress.
3007 * The "mode" argument contains the "TARGET_LOOK" bit flag, which
3008 * indicates that the "space" key should scan through the contents
3009 * of the grid, instead of simply returning immediately. This lets
3010 * the "look" command get complete information, without making the
3011 * "target" command annoying.
3013 * The "info" argument contains the "commands" which should be shown
3014 * inside the "[xxx]" text. This string must never be empty, or grids
3015 * containing monsters will be displayed with an extra comma.
3017 * Note that if a monster is in the grid, we update both the monster
3018 * recall info and the health bar info to track that monster.
3020 * Eventually, we may allow multiple objects per grid, or objects
3021 * and terrain features in the same grid. XXX XXX XXX
3023 * This function must handle blindness/hallucination.
3025 static int target_set_aux(int y, int x, int mode, cptr info)
3027 cave_type *c_ptr = &cave[y][x];
3028 s16b this_o_idx, next_o_idx = 0;
3029 cptr s1 = "", s2 = "", s3 = "", x_info = "";
3032 feature_type *f_ptr;
3034 char out_val[MAX_NLEN+80];
3036 #ifdef ALLOW_EASY_FLOOR
3037 int floor_list[23], floor_num = 0;
3039 /* Scan all objects in the grid */
3042 floor_num = scan_floor(floor_list, y, x, 0x02);
3054 #endif /* ALLOW_EASY_FLOOR */
3056 /* Hack -- under the player */
3057 if (player_bold(y, x))
3080 /* Hack -- hallucination */
3084 cptr name = "²¿¤«´ñ̯¤Êʪ";
3086 cptr name = "something strange";
3090 /* Display a message */
3092 sprintf(out_val, "%s%s%s%s [%s]", s1, name, s2, s3, info);
3094 sprintf(out_val, "%s%s%s%s [%s]", s1, s2, s3, name, info);
3098 move_cursor_relative(y, x);
3101 /* Stop on everything but "return" */
3102 if ((query != '\r') && (query != '\n')) return query;
3104 /* Repeat forever */
3109 /* Actual monsters */
3110 if (c_ptr->m_idx && m_list[c_ptr->m_idx].ml)
3112 monster_type *m_ptr = &m_list[c_ptr->m_idx];
3113 monster_race *ap_r_ptr = &r_info[m_ptr->ap_r_idx];
3115 bool recall = FALSE;
3120 /* Get the monster name ("a kobold") */
3121 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
3123 /* Hack -- track this monster race */
3124 monster_race_track(m_ptr->ap_r_idx);
3126 /* Hack -- health bar for this monster */
3127 health_track(c_ptr->m_idx);
3129 /* Hack -- handle stuff */
3143 /* Recall on screen */
3144 screen_roff(m_ptr->ap_r_idx, 0);
3146 /* Hack -- Complete the prompt (again) */
3148 Term_addstr(-1, TERM_WHITE, format(" [r»× %s%s]", x_info, info));
3150 Term_addstr(-1, TERM_WHITE, format(" [r,%s%s]", x_info, info));
3159 /* Normal commands */
3160 if (query != 'r') break;
3165 /* Cleare recall text and repeat */
3171 /* Describe, and prompt for recall */
3172 evaluate_monster_exp(acount, m_ptr);
3175 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);
3177 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);
3183 move_cursor_relative(y, x);
3188 /* Normal commands */
3189 if (query != 'r') break;
3195 /* Always stop at "normal" keys */
3196 if ((query != '\r') && (query != '\n') && (query != ' ') && (query != 'x')) return query;
3198 /* Sometimes stop at "space" key */
3199 if ((query == ' ') && !(mode & (TARGET_LOOK))) return query;
3201 /* Change the intro */
3209 /* Hack -- take account of gender */
3211 if (ap_r_ptr->flags1 & (RF1_FEMALE)) s1 = "Èà½÷¤Ï";
3213 if (ap_r_ptr->flags1 & (RF1_FEMALE)) s1 = "She is ";
3217 else if (ap_r_ptr->flags1 & (RF1_MALE)) s1 = "Èà¤Ï";
3219 else if (ap_r_ptr->flags1 & (RF1_MALE)) s1 = "He is ";
3223 /* Use a preposition */
3232 /* Scan all objects being carried */
3233 for (this_o_idx = m_ptr->hold_o_idx; this_o_idx; this_o_idx = next_o_idx)
3235 char o_name[MAX_NLEN];
3239 /* Acquire object */
3240 o_ptr = &o_list[this_o_idx];
3242 /* Acquire next object */
3243 next_o_idx = o_ptr->next_o_idx;
3245 /* Obtain an object description */
3246 object_desc(o_name, o_ptr, 0);
3248 /* Describe the object */
3250 sprintf(out_val, "%s%s%s%s[%s]", s1, o_name, s2, s3, info);
3252 sprintf(out_val, "%s%s%s%s [%s]", s1, s2, s3, o_name, info);
3256 move_cursor_relative(y, x);
3259 /* Always stop at "normal" keys */
3260 if ((query != '\r') && (query != '\n') && (query != ' ') && (query != 'x')) return query;
3262 /* Sometimes stop at "space" key */
3263 if ((query == ' ') && !(mode & (TARGET_LOOK))) return query;
3265 /* Change the intro */
3269 s2 = "also carrying ";
3273 /* Use a preposition */
3283 #ifdef ALLOW_EASY_FLOOR
3292 char o_name[MAX_NLEN];
3296 /* Acquire object */
3297 o_ptr = &o_list[floor_list[0]];
3299 /* Describe the object */
3300 object_desc(o_name, o_ptr, 0);
3304 sprintf(out_val, "%s%s%s%s[%s]",
3305 s1, o_name, s2, s3, info);
3307 sprintf(out_val, "%s%s%s%s [%s]",
3308 s1, s2, s3, o_name, info);
3312 move_cursor_relative(y, x);
3321 /* Provide one cushion before item listing */
3324 /* Display rough information about items */
3326 sprintf(out_val, "%s %d¸Ä¤Î¥¢¥¤¥Æ¥à%s%s ['x'¤Ç°ìÍ÷, %s]",
3327 s1, floor_num, s2, s3, info);
3329 sprintf(out_val, "%s%s%sa pile of %d items [x,%s]",
3330 s1, s2, s3, floor_num, info);
3334 move_cursor_relative(y, x);
3339 /* No request for listing */
3340 if (query != 'x' && query != ' ') return query;
3344 /** Display list of items **/
3346 /* Continue scrolling list if requested */
3355 (void)show_floor(0, y, x, &min_width);
3359 sprintf(out_val, "%s %d¸Ä¤Î¥¢¥¤¥Æ¥à%s%s [Enter¤Ç¼¡¤Ø, %s]",
3360 s1, floor_num, s2, s3, info);
3362 sprintf(out_val, "%s%s%sa pile of %d items [Enter,%s]",
3363 s1, s2, s3, floor_num, info);
3374 /* Exit unless 'Enter' */
3375 if (query != '\n' && query != '\r')
3380 /* Get the object being moved. */
3381 o_idx = c_ptr->o_idx;
3383 /* Only rotate a pile of two or more objects. */
3384 if (!(o_idx && o_list[o_idx].next_o_idx)) continue;
3386 /* Remove the first object from the list. */
3387 excise_object_idx(o_idx);
3389 /* Find end of the list. */
3391 while (o_list[i].next_o_idx)
3392 i = o_list[i].next_o_idx;
3394 /* Add after the last object. */
3395 o_list[i].next_o_idx = o_idx;
3397 /* Loop and re-display the list */
3403 #endif /* ALLOW_EASY_FLOOR */
3406 /* Scan all objects in the grid */
3407 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
3411 /* Acquire object */
3412 o_ptr = &o_list[this_o_idx];
3414 /* Acquire next object */
3415 next_o_idx = o_ptr->next_o_idx;
3420 char o_name[MAX_NLEN];
3425 /* Obtain an object description */
3426 object_desc(o_name, o_ptr, 0);
3428 /* Describe the object */
3430 sprintf(out_val, "%s%s%s%s[%s]", s1, o_name, s2, s3, info);
3432 sprintf(out_val, "%s%s%s%s [%s]", s1, s2, s3, o_name, info);
3436 move_cursor_relative(y, x);
3439 /* Always stop at "normal" keys */
3440 if ((query != '\r') && (query != '\n') && (query != ' ') && (query != 'x')) return query;
3442 /* Sometimes stop at "space" key */
3443 if ((query == ' ') && !(mode & TARGET_LOOK)) return query;
3445 /* Change the intro */
3455 if (o_ptr->number != 1) s1 = "¤½¤ì¤é¤Ï";
3457 if (o_ptr->number != 1) s1 = "They are ";
3473 /* Feature code (applying "mimic" field) */
3474 feat = get_feat_mimic(c_ptr);
3476 /* Require knowledge about grid, or ability to see grid */
3477 if (!(c_ptr->info & CAVE_MARK) && !player_can_see_bold(y, x))
3479 /* Forget feature */
3483 f_ptr = &f_info[feat];
3485 /* Terrain feature if needed */
3486 if (boring || have_flag(f_ptr->flags, FF_REMEMBER))
3490 /* Hack -- special handling for building doors */
3491 if (have_flag(f_ptr->flags, FF_BLDG) && !p_ptr->inside_arena)
3493 name = building[f_ptr->power].name;
3495 else if (have_flag(f_ptr->flags, FF_ENTRANCE))
3498 name = format("%s(%d³¬ÁêÅö)", d_text + d_info[c_ptr->special].text, d_info[c_ptr->special].mindepth);
3500 name = format("%s(level %d)", d_text + d_info[c_ptr->special].text, d_info[c_ptr->special].mindepth);
3503 else if (have_flag(f_ptr->flags, FF_TOWN))
3505 name = town[c_ptr->special].name;
3507 else if (p_ptr->wild_mode && (feat == FEAT_FLOOR))
3517 name = f_name + f_ptr->name;
3523 ((!have_flag(f_ptr->flags, FF_MOVE) && !have_flag(f_ptr->flags, FF_CAN_FLY)) ||
3524 (!have_flag(f_ptr->flags, FF_LOS) && !have_flag(f_ptr->flags, FF_TREE)) ||
3525 have_flag(f_ptr->flags, FF_TOWN)))
3534 /* Hack -- special introduction for store & building doors -KMW- */
3535 if (have_flag(f_ptr->flags, FF_STORE) ||
3536 (have_flag(f_ptr->flags, FF_BLDG) && !p_ptr->inside_arena) ||
3537 have_flag(f_ptr->flags, FF_ENTRANCE))
3546 else if (have_flag(f_ptr->flags, FF_FLOOR) ||
3547 have_flag(f_ptr->flags, FF_TOWN) ||
3548 have_flag(f_ptr->flags, FF_SHALLOW) ||
3549 have_flag(f_ptr->flags, FF_DEEP))
3555 /* Pick proper indefinite article */
3556 s3 = (is_a_vowel(name[0])) ? "an " : "a ";
3560 /* Display a message */
3564 if (c_ptr->mimic) sprintf(f_idx_str, "%d/%d", c_ptr->feat, c_ptr->mimic);
3565 else sprintf(f_idx_str, "%d", c_ptr->feat);
3567 sprintf(out_val, "%s%s%s%s[%s] %x %s %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);
3569 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);
3574 sprintf(out_val, "%s%s%s%s[%s]", s1, name, s2, s3, info);
3576 sprintf(out_val, "%s%s%s%s [%s]", s1, s2, s3, name, info);
3580 move_cursor_relative(y, x);
3583 /* Always stop at "normal" keys */
3584 if ((query != '\r') && (query != '\n') && (query != ' ')) return query;
3587 /* Stop on everything but "return" */
3588 if ((query != '\r') && (query != '\n')) return query;
3590 /* Repeat forever */
3596 * Handle "target" and "look".
3598 * Note that this code can be called from "get_aim_dir()".
3600 * All locations must be on the current panel. Consider the use of
3601 * "panel_bounds()" to allow "off-panel" targets, perhaps by using
3602 * some form of "scrolling" the map around the cursor. XXX XXX XXX
3603 * That is, consider the possibility of "auto-scrolling" the screen
3604 * while the cursor moves around. This may require changes in the
3605 * "update_mon()" code to allow "visibility" even if off panel, and
3606 * may require dynamic recalculation of the "temp" grid set.
3608 * Hack -- targeting/observing an "outer border grid" may induce
3609 * problems, so this is not currently allowed.
3611 * The player can use the direction keys to move among "interesting"
3612 * grids in a heuristic manner, or the "space", "+", and "-" keys to
3613 * move through the "interesting" grids in a sequential manner, or
3614 * can enter "location" mode, and use the direction keys to move one
3615 * grid at a time in any direction. The "t" (set target) command will
3616 * only target a monster (as opposed to a location) if the monster is
3617 * target_able and the "interesting" mode is being used.
3619 * The current grid is described using the "look" method above, and
3620 * a new command may be entered at any time, but note that if the
3621 * "TARGET_LOOK" bit flag is set (or if we are in "location" mode,
3622 * where "space" has no obvious meaning) then "space" will scan
3623 * through the description of the current grid until done, instead
3624 * of immediately jumping to the next "interesting" grid. This
3625 * allows the "target" command to retain its old semantics.
3627 * The "*", "+", and "-" keys may always be used to jump immediately
3628 * to the next (or previous) interesting grid, in the proper mode.
3630 * The "return" key may always be used to scan through a complete
3631 * grid description (forever).
3633 * This command will cancel any old target, even if used from
3634 * inside the "look" command.
3636 bool target_set(int mode)
3656 get_screen_size(&wid, &hgt);
3662 /* Cancel tracking */
3663 /* health_track(0); */
3666 /* Prepare the "temp" array */
3667 target_set_prepare(mode);
3669 /* Start near the player */
3675 /* Interesting grids */
3681 if (!(mode & TARGET_LOOK)) prt_path(y, x);
3684 c_ptr = &cave[y][x];
3687 if (target_able(c_ptr->m_idx))
3690 strcpy(info, "q»ß t·è p¼« o¸½ +¼¡ -Á°");
3692 strcpy(info, "q,t,p,o,+,-,<dir>");
3697 /* Dis-allow target */
3701 strcpy(info, "q»ß p¼« o¸½ +¼¡ -Á°");
3703 strcpy(info, "q,p,o,+,-,<dir>");
3708 /* Describe and Prompt */
3709 while (!(query = target_set_aux(y, x, mode, info)));
3711 /* Cancel tracking */
3712 /* health_track(0); */
3714 /* Assume no "direction" */
3719 if (query == '\r') query = 't';
3737 if (target_able(c_ptr->m_idx))
3739 health_track(c_ptr->m_idx);
3740 target_who = c_ptr->m_idx;
3759 if (!expand_list) done = TRUE;
3769 if (!expand_list) done = TRUE;
3776 /* Recenter the map around the player */
3780 p_ptr->update |= (PU_MONSTERS);
3783 p_ptr->redraw |= (PR_MAP);
3786 p_ptr->window |= (PW_OVERHEAD);
3791 /* Recalculate interesting grids */
3792 target_set_prepare(mode);
3811 /* Extract the action (if any) */
3812 d = get_keymap_dir(query);
3819 /* Hack -- move around */
3822 /* Modified to scroll to monster */
3823 int y2 = panel_row_min;
3824 int x2 = panel_col_min;
3826 /* Find a new monster */
3827 i = target_pick(temp_y[m], temp_x[m], ddy[d], ddx[d]);
3829 /* Request to target past last interesting grid */
3830 while (flag && (i < 0))
3832 /* Note the change */
3833 if (change_panel(ddy[d], ddx[d]))
3838 /* Recalculate interesting grids */
3839 target_set_prepare(mode);
3841 /* Look at interesting grids */
3844 /* Find a new monster */
3845 i = target_pick(v, u, ddy[d], ddx[d]);
3851 /* Nothing interesting */
3857 /* Restore previous position */
3860 panel_bounds_center();
3863 p_ptr->update |= (PU_MONSTERS);
3866 p_ptr->redraw |= (PR_MAP);
3869 p_ptr->window |= (PW_OVERHEAD);
3874 /* Recalculate interesting grids */
3875 target_set_prepare(mode);
3877 /* Look at boring grids */
3884 /* Do not move horizontally if unnecessary */
3885 if (((x < panel_col_min + wid / 2) && (dx > 0)) ||
3886 ((x > panel_col_min + wid / 2) && (dx < 0)))
3891 /* Do not move vertically if unnecessary */
3892 if (((y < panel_row_min + hgt / 2) && (dy > 0)) ||
3893 ((y > panel_row_min + hgt / 2) && (dy < 0)))
3898 /* Apply the motion */
3899 if ((y >= panel_row_min+hgt) || (y < panel_row_min) ||
3900 (x >= panel_col_min+wid) || (x < panel_col_min))
3902 if (change_panel(dy, dx)) target_set_prepare(mode);
3905 /* Slide into legality */
3906 if (x >= cur_wid-1) x = cur_wid - 2;
3907 else if (x <= 0) x = 1;
3909 /* Slide into legality */
3910 if (y >= cur_hgt-1) y = cur_hgt- 2;
3911 else if (y <= 0) y = 1;
3920 /* Arbitrary grids */
3923 bool move_fast = FALSE;
3925 if (!(mode & TARGET_LOOK)) prt_path(y, x);
3928 c_ptr = &cave[y][x];
3930 /* Default prompt */
3932 strcpy(info, "q»ß t·è p¼« m¶á +¼¡ -Á°");
3934 strcpy(info, "q,t,p,m,+,-,<dir>");
3938 /* Describe and Prompt (enable "TARGET_LOOK") */
3939 while (!(query = target_set_aux(y, x, mode | TARGET_LOOK, info)));
3941 /* Cancel tracking */
3942 /* health_track(0); */
3944 /* Assume no direction */
3949 if (query == '\r') query = 't';
3952 /* Analyze the keypress */
3976 /* Recenter the map around the player */
3980 p_ptr->update |= (PU_MONSTERS);
3983 p_ptr->redraw |= (PR_MAP);
3986 p_ptr->window |= (PW_OVERHEAD);
3991 /* Recalculate interesting grids */
3992 target_set_prepare(mode);
4014 /* Pick a nearby monster */
4015 for (i = 0; i < temp_n; i++)
4017 t = distance(y, x, temp_y[i], temp_x[i]);
4027 /* Nothing interesting */
4028 if (bd == 999) flag = FALSE;
4035 /* Extract the action (if any) */
4036 d = get_keymap_dir(query);
4038 /* XTRA HACK MOVEFAST */
4039 if (isupper(query)) move_fast = TRUE;
4046 /* Handle "direction" */
4052 /* XTRA HACK MOVEFAST */
4055 int mag = MIN(wid / 2, hgt / 2);
4065 /* Do not move horizontally if unnecessary */
4066 if (((x < panel_col_min + wid / 2) && (dx > 0)) ||
4067 ((x > panel_col_min + wid / 2) && (dx < 0)))
4072 /* Do not move vertically if unnecessary */
4073 if (((y < panel_row_min + hgt / 2) && (dy > 0)) ||
4074 ((y > panel_row_min + hgt / 2) && (dy < 0)))
4079 /* Apply the motion */
4080 if ((y >= panel_row_min + hgt) || (y < panel_row_min) ||
4081 (x >= panel_col_min + wid) || (x < panel_col_min))
4083 if (change_panel(dy, dx)) target_set_prepare(mode);
4086 /* Slide into legality */
4087 if (x >= cur_wid-1) x = cur_wid - 2;
4088 else if (x <= 0) x = 1;
4090 /* Slide into legality */
4091 if (y >= cur_hgt-1) y = cur_hgt- 2;
4092 else if (y <= 0) y = 1;
4100 /* Clear the top line */
4103 /* Recenter the map around the player */
4107 p_ptr->update |= (PU_MONSTERS);
4110 p_ptr->redraw |= (PR_MAP);
4113 p_ptr->window |= (PW_OVERHEAD);
4118 /* Failure to set target */
4119 if (!target_who) return (FALSE);
4127 * Get an "aiming direction" from the user.
4129 * The "dir" is loaded with 1,2,3,4,6,7,8,9 for "actual direction", and
4130 * "0" for "current target", and "-1" for "entry aborted".
4132 * Note that "Force Target", if set, will pre-empt user interaction,
4133 * if there is a usable target already set.
4135 * Note that confusion over-rides any (explicit?) user choice.
4137 bool get_aim_dir(int *dp)
4148 /* Global direction */
4151 /* Hack -- auto-target if requested */
4152 if (use_old_target && target_okay()) dir = 5;
4154 #ifdef ALLOW_REPEAT /* TNB */
4156 if (repeat_pull(dp))
4161 if (!(*dp == 5 && !target_okay()))
4163 /* return (TRUE); */
4168 #endif /* ALLOW_REPEAT -- TNB */
4170 /* Ask until satisfied */
4173 /* Choose a prompt */
4177 p = "Êý¸þ ('*'¤Ç¥¿¡¼¥²¥Ã¥ÈÁªÂò, ESC¤ÇÃæÃÇ)? ";
4179 p = "Direction ('*' to choose a target, Escape to cancel)? ";
4186 p = "Êý¸þ ('5'¤Ç¥¿¡¼¥²¥Ã¥È¤Ø, '*'¤Ç¥¿¡¼¥²¥Ã¥ÈºÆÁªÂò, ESC¤ÇÃæÃÇ)? ";
4188 p = "Direction ('5' for target, '*' to re-target, Escape to cancel)? ";
4193 /* Get a command (or Cancel) */
4194 if (!get_com(p, &command, TRUE)) break;
4198 if (command == '\r') command = 't';
4201 /* Convert various keys to "standard" keys */
4204 /* Use current target */
4215 /* Set new target */
4220 if (target_set(TARGET_KILL)) dir = 5;
4226 /* Extract the action (if any) */
4227 dir = get_keymap_dir(command);
4233 /* Verify requested targets */
4234 if ((dir == 5) && !target_okay()) dir = 0;
4243 project_length = 0; /* reset to default */
4247 /* Save the direction */
4250 /* Check for confusion */
4251 if (p_ptr->confused)
4254 /* Random direction */
4255 dir = ddd[randint0(8)];
4258 /* Notice confusion */
4259 if (command_dir != dir)
4263 msg_print("¤¢¤Ê¤¿¤Ïº®Í𤷤Ƥ¤¤ë¡£");
4265 msg_print("You are confused.");
4270 /* Save direction */
4273 #ifdef ALLOW_REPEAT /* TNB */
4275 /* repeat_push(dir); */
4276 repeat_push(command_dir);
4278 #endif /* ALLOW_REPEAT -- TNB */
4280 /* A "valid" direction was entered */
4287 * Request a "movement" direction (1,2,3,4,6,7,8,9) from the user,
4288 * and place it into "command_dir", unless we already have one.
4290 * This function should be used for all "repeatable" commands, such as
4291 * run, walk, open, close, bash, disarm, spike, tunnel, etc, as well
4292 * as all commands which must reference a grid adjacent to the player,
4293 * and which may not reference the grid under the player. Note that,
4294 * for example, it is no longer possible to "disarm" or "open" chests
4295 * in the same grid as the player.
4297 * Direction "5" is illegal and will (cleanly) abort the command.
4299 * This function tracks and uses the "global direction", and uses
4300 * that as the "desired direction", to which "confusion" is applied.
4302 bool get_rep_dir(int *dp, bool under)
4309 /* Global direction */
4312 #ifdef ALLOW_REPEAT /* TNB */
4314 if (repeat_pull(dp))
4317 /* return (TRUE); */
4320 #endif /* ALLOW_REPEAT -- TNB */
4322 /* Get a direction */
4327 /* Get a command (or Cancel) */
4329 if (!get_com("Êý¸þ (ESC¤ÇÃæÃÇ)? ", &ch, TRUE)) break;
4331 if (!get_com("Direction (Escape to cancel)? ", &ch, TRUE)) break;
4335 /* Look up the direction */
4336 dir = get_keymap_dir(ch);
4342 /* Prevent weirdness */
4343 if ((dir == 5) && (!under)) dir = 0;
4346 if (!dir) return (FALSE);
4348 /* Save desired direction */
4351 /* Apply "confusion" */
4352 if (p_ptr->confused)
4354 /* Standard confusion */
4355 if (randint0(100) < 75)
4357 /* Random direction */
4358 dir = ddd[randint0(8)];
4361 else if (p_ptr->riding)
4363 monster_type *m_ptr = &m_list[p_ptr->riding];
4364 monster_race *r_ptr = &r_info[m_ptr->r_idx];
4366 if (m_ptr->confused)
4368 /* Standard confusion */
4369 if (randint0(100) < 75)
4371 /* Random direction */
4372 dir = ddd[randint0(8)];
4375 else if ((r_ptr->flags1 & RF1_RAND_50) && (r_ptr->flags1 & RF1_RAND_25) && (randint0(100) < 50))
4377 /* Random direction */
4378 dir = ddd[randint0(8)];
4380 else if ((r_ptr->flags1 & RF1_RAND_50) && (randint0(100) < 25))
4382 /* Random direction */
4383 dir = ddd[randint0(8)];
4387 /* Notice confusion */
4388 if (command_dir != dir)
4390 if (p_ptr->confused)
4394 msg_print("¤¢¤Ê¤¿¤Ïº®Í𤷤Ƥ¤¤ë¡£");
4396 msg_print("You are confused.");
4402 monster_type *m_ptr = &m_list[p_ptr->riding];
4404 monster_desc(m_name, m_ptr, 0);
4405 if (m_ptr->confused)
4408 msg_format("%s¤Ïº®Í𤷤Ƥ¤¤ë¡£", m_name);
4410 msg_format("%^s is confusing.", m_name);
4417 msg_format("%s¤Ï»×¤¤Ä̤ê¤ËÆ°¤¤¤Æ¤¯¤ì¤Ê¤¤¡£", m_name);
4419 msg_format("You cannot control %s.", m_name);
4425 /* Save direction */
4428 #ifdef ALLOW_REPEAT /* TNB */
4430 /* repeat_push(dir); */
4431 repeat_push(command_dir);
4433 #endif /* ALLOW_REPEAT -- TNB */
4440 bool get_rep_dir2(int *dp)
4447 /* Global direction */
4450 #ifdef ALLOW_REPEAT /* TNB */
4452 if (repeat_pull(dp))
4455 /* return (TRUE); */
4458 #endif /* ALLOW_REPEAT -- TNB */
4460 /* Get a direction */
4465 /* Get a command (or Cancel) */
4467 if (!get_com("Êý¸þ (ESC¤ÇÃæÃÇ)? ", &ch, TRUE)) break;
4469 if (!get_com("Direction (Escape to cancel)? ", &ch, TRUE)) break;
4473 /* Look up the direction */
4474 dir = get_keymap_dir(ch);
4480 /* Prevent weirdness */
4481 if (dir == 5) dir = 0;
4484 if (!dir) return (FALSE);
4486 /* Save desired direction */
4489 /* Apply "confusion" */
4490 if (p_ptr->confused)
4492 /* Standard confusion */
4493 if (randint0(100) < 75)
4495 /* Random direction */
4496 dir = ddd[randint0(8)];
4500 /* Notice confusion */
4501 if (command_dir != dir)
4505 msg_print("¤¢¤Ê¤¿¤Ïº®Í𤷤Ƥ¤¤ë¡£");
4507 msg_print("You are confused.");
4512 /* Save direction */
4515 #ifdef ALLOW_REPEAT /* TNB */
4517 /* repeat_push(dir); */
4518 repeat_push(command_dir);
4520 #endif /* ALLOW_REPEAT -- TNB */
4527 void gain_level_reward(int chosen_reward)
4531 char wrath_reason[32] = "";
4532 int nasty_chance = 6;
4533 int dummy = 0, dummy2 = 0;
4536 char o_name[MAX_NLEN];
4542 if (multi_rew) return;
4543 else multi_rew = TRUE;
4547 if (p_ptr->lev == 13) nasty_chance = 2;
4548 else if (!(p_ptr->lev % 13)) nasty_chance = 3;
4549 else if (!(p_ptr->lev % 14)) nasty_chance = 12;
4551 if (one_in_(nasty_chance))
4552 type = randint1(20); /* Allow the 'nasty' effects */
4554 type = randint1(15) + 5; /* Or disallow them */
4556 if (type < 1) type = 1;
4557 if (type > 20) type = 20;
4562 sprintf(wrath_reason, "%s¤ÎÅܤê",
4563 chaos_patrons[p_ptr->chaos_patron]);
4565 sprintf(wrath_reason, "the Wrath of %s",
4566 chaos_patrons[p_ptr->chaos_patron]);
4570 effect = chaos_rewards[p_ptr->chaos_patron][type];
4572 if (one_in_(6) && !chosen_reward)
4575 msg_format("%^s¤ÏË«Èþ¤È¤·¤Æ¤¢¤Ê¤¿¤òÆÍÁ³ÊÑ°Û¤µ¤»¤¿¡£",
4576 chaos_patrons[p_ptr->chaos_patron]);
4578 msg_format("%^s rewards you with a mutation!",
4579 chaos_patrons[p_ptr->chaos_patron]);
4582 (void)gain_random_mutation(0);
4584 reward = "ÊÑ°Û¤·¤¿¡£";
4586 reward = "mutation";
4591 switch (chosen_reward ? chosen_reward : effect)
4595 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
4596 chaos_patrons[p_ptr->chaos_patron]);
4598 msg_format("The voice of %s booms out:",
4599 chaos_patrons[p_ptr->chaos_patron]);
4603 msg_print("¡ÖÆò¡¢¿·¤¿¤Ê¤ë»Ñ¤òɬÍפȤ»¤ê¡ª¡×");
4605 msg_print("'Thou needst a new form, mortal!'");
4610 reward = "ÊÑ°Û¤·¤¿¡£";
4612 reward = "polymorphing";
4617 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
4618 chaos_patrons[p_ptr->chaos_patron]);
4620 msg_format("The voice of %s booms out:",
4621 chaos_patrons[p_ptr->chaos_patron]);
4625 msg_print("¡ÖÆò¤ÏÎɤ¯¹Ô¤¤¤¿¤ê¡ªÂ³¤±¤è¡ª¡×");
4627 msg_print("'Well done, mortal! Lead on!'");
4630 if (p_ptr->prace == RACE_ANDROID)
4633 msg_print("¤·¤«¤·²¿¤âµ¯¤³¤é¤Ê¤«¤Ã¤¿¡£");
4635 msg_print("But, nothing happen.");
4638 else if (p_ptr->exp < PY_MAX_EXP)
4640 s32b ee = (p_ptr->exp / 2) + 10;
4641 if (ee > 100000L) ee = 100000L;
4643 msg_print("¹¹¤Ë·Ð¸³¤òÀѤó¤À¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£");
4645 msg_print("You feel more experienced.");
4650 reward = "·Ð¸³ÃͤòÆÀ¤¿";
4652 reward = "experience";
4658 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
4659 chaos_patrons[p_ptr->chaos_patron]);
4661 msg_format("The voice of %s booms out:",
4662 chaos_patrons[p_ptr->chaos_patron]);
4666 msg_print("¡Ö²¼Ëͤ衢Æò¤½¤ì¤ËÃͤ»¤º¡£¡×");
4668 msg_print("'Thou didst not deserve that, slave.'");
4671 if (p_ptr->prace == RACE_ANDROID)
4674 msg_print("¤·¤«¤·²¿¤âµ¯¤³¤é¤Ê¤«¤Ã¤¿¡£");
4676 msg_print("But, nothing happen.");
4681 lose_exp(p_ptr->exp / 6);
4683 reward = "·Ð¸³Ãͤò¼º¤Ã¤¿¡£";
4685 reward = "losing experience";
4691 msg_format("%s¤ÎÀ¼¤¬¤µ¤µ¤ä¤¤¤¿:",
4692 chaos_patrons[p_ptr->chaos_patron]);
4694 msg_format("The voice of %s whispers:",
4695 chaos_patrons[p_ptr->chaos_patron]);
4699 msg_print("¡Ö²æ¤¬Í¿¤¨¤·Êª¤ò¸ÌÀ¤Ë»È¤¦¤Ù¤·¡£¡×");
4701 msg_print("'Use my gift wisely.'");
4704 acquirement(py, px, 1, FALSE, FALSE);
4706 reward = "¾å¼Á¤Ê¥¢¥¤¥Æ¥à¤ò¼ê¤ËÆþ¤ì¤¿¡£";
4708 reward = "a good item";
4713 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
4714 chaos_patrons[p_ptr->chaos_patron]);
4716 msg_format("The voice of %s booms out:",
4717 chaos_patrons[p_ptr->chaos_patron]);
4721 msg_print("¡Ö²æ¤¬Í¿¤¨¤·Êª¤ò¸ÌÀ¤Ë»È¤¦¤Ù¤·¡£¡×");
4723 msg_print("'Use my gift wisely.'");
4726 acquirement(py, px, 1, TRUE, FALSE);
4728 reward = "¹âµéÉʤΥ¢¥¤¥Æ¥à¤ò¼ê¤ËÆþ¤ì¤¿¡£";
4730 reward = "an excellent item";
4735 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
4736 chaos_patrons[p_ptr->chaos_patron]);
4738 msg_format("The voice of %s booms out:",
4739 chaos_patrons[p_ptr->chaos_patron]);
4743 msg_print("¡ÖÆò¤Î¹Ô¤¤¤Ïµ®¤·õ¤ËÃͤ»¤ê¡£¡×");
4745 msg_print("'Thy deed hath earned thee a worthy blade.'");
4748 /* Get local object */
4751 switch (randint1(p_ptr->lev))
4757 dummy2 = SV_MAIN_GAUCHE;
4766 dummy2 = SV_SMALL_SWORD;
4769 dummy2 = SV_BASILLARD;
4771 case 11: case 12: case 13:
4772 dummy2 = SV_SHORT_SWORD;
4778 dummy2 = SV_CUTLASS;
4781 dummy2 = SV_WAKIZASHI;
4784 dummy2 = SV_KHOPESH;
4790 dummy2 = SV_BROAD_SWORD;
4793 dummy2 = SV_LONG_SWORD;
4796 dummy2 = SV_SCIMITAR;
4799 dummy2 = SV_NINJATO;
4805 dummy2 = SV_BASTARD_SWORD;
4808 dummy2 = SV_GREAT_SCIMITAR;
4811 dummy2 = SV_CLAYMORE;
4814 dummy2 = SV_ESPADON;
4817 dummy2 = SV_TWO_HANDED_SWORD;
4820 dummy2 = SV_FLAMBERGE;
4823 dummy2 = SV_NO_DACHI;
4826 dummy2 = SV_EXECUTIONERS_SWORD;
4829 dummy2 = SV_ZWEIHANDER;
4832 dummy2 = SV_HAYABUSA;
4835 dummy2 = SV_BLADE_OF_CHAOS;
4838 object_prep(q_ptr, lookup_kind(dummy, dummy2));
4839 q_ptr->to_h = 3 + randint1(dun_level) % 10;
4840 q_ptr->to_d = 3 + randint1(dun_level) % 10;
4841 one_resistance(q_ptr);
4842 q_ptr->name2 = EGO_CHAOTIC;
4844 /* Drop it in the dungeon */
4845 (void)drop_near(q_ptr, -1, py, px);
4847 reward = "(º®ÆÙ)¤ÎÉð´ï¤ò¼ê¤ËÆþ¤ì¤¿¡£";
4849 reward = "chaos weapon";
4854 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
4855 chaos_patrons[p_ptr->chaos_patron]);
4857 msg_format("The voice of %s booms out:",
4858 chaos_patrons[p_ptr->chaos_patron]);
4862 msg_print("¡ÖÆò¤Î¹Ô¤¤¤Ïµ®¤Ê󤤤ËÃͤ»¤ê¡£¡×");
4864 msg_print("'Thy deed hath earned thee a worthy reward.'");
4867 acquirement(py, px, randint1(2) + 1, FALSE, FALSE);
4869 reward = "¾å¼Á¤Ê¥¢¥¤¥Æ¥à¤ò¼ê¤ËÆþ¤ì¤¿¡£";
4871 reward = "good items";
4876 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
4877 chaos_patrons[p_ptr->chaos_patron]);
4879 msg_format("The voice of %s booms out:",
4880 chaos_patrons[p_ptr->chaos_patron]);
4884 msg_print("¡Ö²¼Ëͤ衢Æò¤Î¸¥¿È¤Ø¤Î²æ¤¬Àˤ·¤ß̵¤Ê󤤤ò¸«¤ë¤¬¤è¤¤¡£¡×");
4886 msg_print("'Behold, mortal, how generously I reward thy loyalty.'");
4889 acquirement(py, px, randint1(2) + 1, TRUE, FALSE);
4891 reward = "¹âµéÉʤΥ¢¥¤¥Æ¥à¤ò¼ê¤ËÆþ¤ì¤¿¡£";
4893 reward = "excellent items";
4898 msg_format("%s¤ÎÀ¼¤¬¹ì¤ÅϤä¿:",
4899 chaos_patrons[p_ptr->chaos_patron]);
4901 msg_format("The voice of %s thunders:",
4902 chaos_patrons[p_ptr->chaos_patron]);
4906 msg_print("¡Ö²¼Ëͤ衢ÆòÐþËý¤Ê¤ê¡£¡×");
4908 msg_print("'Thou art growing arrogant, mortal.'");
4911 (void)activate_ty_curse(FALSE, &count);
4913 reward = "²Ò¡¹¤·¤¤¼ö¤¤¤ò¤«¤±¤é¤ì¤¿¡£";
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("'My pets, destroy the arrogant mortal!'");
4933 for (dummy = 0; dummy < randint1(5) + 1; dummy++)
4935 (void)summon_specific(0, py, px, dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
4938 reward = "¥â¥ó¥¹¥¿¡¼¤ò¾¤´¤µ¤ì¤¿¡£";
4940 reward = "summoning hostile monsters";
4945 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
4946 chaos_patrons[p_ptr->chaos_patron]);
4948 msg_format("The voice of %s booms out:",
4949 chaos_patrons[p_ptr->chaos_patron]);
4953 msg_print("¡ÖÆò¡¢¤è¤ê¶¯¤Å¨¤òɬÍפȤ»¤ê¡ª¡×");
4955 msg_print("'Thou needst worthier opponents!'");
4958 activate_hi_summon(py, px, FALSE);
4960 reward = "¥â¥ó¥¹¥¿¡¼¤ò¾¤´¤µ¤ì¤¿¡£";
4962 reward = "summoning many hostile monsters";
4967 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
4968 chaos_patrons[p_ptr->chaos_patron]);
4970 msg_format("The voice of %s booms out:",
4971 chaos_patrons[p_ptr->chaos_patron]);
4975 msg_print("¡Ö»à¤ÈÇ˲õ¤³¤½²æ¤¬´î¤Ó¤Ê¤ê¡ª¡×");
4977 msg_print("'Death and destruction! This pleaseth me!'");
4982 reward = "¥«¥ª¥¹¤ÎÎϤ¬±²´¬¤¤¤¿¡£";
4984 reward = "calling chaos";
4989 msg_format("%s¤ÎÀ¼¤¬ÌĤê¶Á¤¤¤¿:",
4990 chaos_patrons[p_ptr->chaos_patron]);
4992 msg_format("The voice of %s rings out:",
4993 chaos_patrons[p_ptr->chaos_patron]);
4997 msg_print("¡Öα¤Þ¤ë¤Î¤À¡¢²¼Ëͤ衣;¤¬Æò¤ÎÆùÂΤòÃ䨤󡣡×");
4999 msg_print("'Stay, mortal, and let me mold thee.'");
5002 if (one_in_(3) && !(chaos_stats[p_ptr->chaos_patron] < 0))
5003 do_inc_stat(chaos_stats[p_ptr->chaos_patron]);
5005 do_inc_stat(randint0(6));
5007 reward = "ǽÎÏÃͤ¬¾å¤¬¤Ã¤¿¡£";
5009 reward = "increasing a stat";
5014 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5015 chaos_patrons[p_ptr->chaos_patron]);
5017 msg_format("The voice of %s booms out:",
5018 chaos_patrons[p_ptr->chaos_patron]);
5022 msg_print("¡Ö²¼Ëͤ衢;¤ÏÆò¤ËË°¤ß¤¿¤ê¡£¡×");
5024 msg_print("'I grow tired of thee, mortal.'");
5027 if (one_in_(3) && !(chaos_stats[p_ptr->chaos_patron] < 0))
5028 do_dec_stat(chaos_stats[p_ptr->chaos_patron]);
5030 (void)do_dec_stat(randint0(6));
5032 reward = "ǽÎÏÃͤ¬²¼¤¬¤Ã¤¿¡£";
5034 reward = "decreasing a stat";
5039 msg_format("%s¤ÎÀ¼¤¬¹ì¤ÅϤä¿:",
5040 chaos_patrons[p_ptr->chaos_patron]);
5042 msg_format("The voice of %s thunders:",
5043 chaos_patrons[p_ptr->chaos_patron]);
5047 msg_print("¡ÖÆò¡¢¸¬µõ¤¿¤ë¤³¤È¤ò³Ø¤Ö¤Ù¤·¡ª¡×");
5048 msg_print("¤¢¤Ê¤¿¤Ï°ÊÁ°¤è¤ê¼å¤¯¤Ê¤Ã¤¿¡ª");
5050 msg_print("'Thou needst a lesson in humility, mortal!'");
5051 msg_print("You feel less powerful!");
5054 for (dummy = 0; dummy < 6; dummy++)
5056 (void)dec_stat(dummy, 10 + randint1(15), TRUE);
5059 reward = "Á´Ç½ÎÏÃͤ¬²¼¤¬¤Ã¤¿¡£";
5061 reward = "decreasing all stats";
5066 msg_format("%s¤ÎÎϤ¬¿¨¤ì¤ë¤Î¤ò´¶¤¸¤¿¡£",
5068 msg_format("You feel the power of %s touch you.",
5071 chaos_patrons[p_ptr->chaos_patron]);
5074 reward = "½ý¤¬ÊѲ½¤·¤¿¡£";
5076 reward = "polymorphing wounds";
5081 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5082 chaos_patrons[p_ptr->chaos_patron]);
5084 msg_format("The voice of %s booms out:",
5085 chaos_patrons[p_ptr->chaos_patron]);
5089 msg_print("¡Ö²æ¤¬¤µ¤µ¤ä¤«¤Ê¤ë»òʪ¤ò¼õ¤±¤È¤ë¤¬¤è¤¤¡ª¡×");
5091 msg_print("'Receive this modest gift from me!'");
5094 for (dummy = 0; dummy < 6; dummy++)
5096 (void)do_inc_stat(dummy);
5099 reward = "Á´Ç½ÎÏÃͤ¬¾å¤¬¤Ã¤¿¡£";
5101 reward = "increasing all stats";
5106 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5107 chaos_patrons[p_ptr->chaos_patron]);
5109 msg_format("The voice of %s booms out:",
5110 chaos_patrons[p_ptr->chaos_patron]);
5114 msg_print("¡Ö¶ì¤·¤à¤¬¤è¤¤¡¢ÌµÇ½¤Ê¶ò¤«¼Ô¤è¡ª¡×");
5116 msg_print("'Suffer, pathetic fool!'");
5119 fire_ball(GF_DISINTEGRATE, 0, p_ptr->lev * 4, 4);
5120 take_hit(DAMAGE_NOESCAPE, p_ptr->lev * 4, wrath_reason, -1);
5122 reward = "ʬ²ò¤Îµå¤¬È¯À¸¤·¤¿¡£";
5124 reward = "generating disintegration ball";
5129 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5130 chaos_patrons[p_ptr->chaos_patron]);
5132 msg_format("The voice of %s booms out:",
5133 chaos_patrons[p_ptr->chaos_patron]);
5137 msg_print("¡Öᴤ뤬¤è¤¤¡¢²æ¤¬²¼Ëͤ衪¡×");
5139 msg_print("'Rise, my servant!'");
5143 (void)set_poisoned(0);
5145 (void)set_confused(0);
5150 for (dummy = 0; dummy < 6; dummy++)
5152 (void)do_res_stat(dummy);
5155 reward = "ÂÎÎϤ¬²óÉü¤·¤¿¡£";
5161 if (!buki_motteruka(INVEN_RARM) && !buki_motteruka(INVEN_LARM)) break;
5163 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5164 chaos_patrons[p_ptr->chaos_patron]);
5166 msg_format("The voice of %s booms out:",
5167 chaos_patrons[p_ptr->chaos_patron]);
5171 msg_print("¡ÖÆò¡¢Éð´ï¤ËÍê¤ë¤³¤È¤Ê¤«¤ì¡£¡×");
5173 msg_print("'Thou reliest too much on thy weapon.'");
5177 if (buki_motteruka(INVEN_LARM))
5180 if (buki_motteruka(INVEN_RARM) && one_in_(2)) dummy = INVEN_RARM;
5182 object_desc(o_name, &inventory[dummy], OD_NAME_ONLY);
5183 (void)curse_weapon(FALSE, dummy);
5185 reward = format("%s¤¬Ç˲õ¤µ¤ì¤¿¡£", o_name);
5187 reward = format("destroying %s", o_name);
5191 if (!inventory[INVEN_BODY].k_idx) break;
5193 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5194 chaos_patrons[p_ptr->chaos_patron]);
5196 msg_format("The voice of %s booms out:",
5197 chaos_patrons[p_ptr->chaos_patron]);
5201 msg_print("¡ÖÆò¡¢Ëɶñ¤ËÍê¤ë¤³¤È¤Ê¤«¤ì¡£¡×");
5203 msg_print("'Thou reliest too much on thine equipment.'");
5206 object_desc(o_name, &inventory[INVEN_BODY], OD_NAME_ONLY);
5207 (void)curse_armor();
5209 reward = format("%s¤¬Ç˲õ¤µ¤ì¤¿¡£", o_name);
5211 reward = format("destroying %s", o_name);
5216 msg_format("%s¤ÎÀ¼¤¬¤µ¤µ¤ä¤¤¤¿:",
5217 chaos_patrons[p_ptr->chaos_patron]);
5219 msg_format("The voice of %s whispers:",
5220 chaos_patrons[p_ptr->chaos_patron]);
5224 msg_print("¡Ö²æ¤òÅܤꤷ¤á¤¿ºá¤ò½þ¤¦¤Ù¤·¡£¡×");
5226 msg_print("'Now thou shalt pay for annoying me.'");
5229 switch (randint1(4))
5232 (void)activate_ty_curse(FALSE, &count);
5234 reward = "²Ò¡¹¤·¤¤¼ö¤¤¤ò¤«¤±¤é¤ì¤¿¡£";
5240 activate_hi_summon(py, px, FALSE);
5242 reward = "¥â¥ó¥¹¥¿¡¼¤ò¾¤´¤µ¤ì¤¿¡£";
5244 reward = "summoning hostile monsters";
5250 if (!buki_motteruka(INVEN_RARM) && !buki_motteruka(INVEN_LARM)) break;
5252 if (buki_motteruka(INVEN_LARM))
5255 if (buki_motteruka(INVEN_RARM) && one_in_(2)) dummy = INVEN_RARM;
5257 object_desc(o_name, &inventory[dummy], OD_NAME_ONLY);
5258 (void)curse_weapon(FALSE, dummy);
5260 reward = format("%s¤¬Ç˲õ¤µ¤ì¤¿¡£", o_name);
5262 reward = format("destroying %s", o_name);
5267 if (!inventory[INVEN_BODY].k_idx) break;
5268 object_desc(o_name, &inventory[INVEN_BODY], OD_NAME_ONLY);
5269 (void)curse_armor();
5271 reward = format("%s¤¬Ç˲õ¤µ¤ì¤¿¡£", o_name);
5273 reward = format("destroying %s", o_name);
5278 for (dummy = 0; dummy < 6; dummy++)
5280 (void)dec_stat(dummy, 10 + randint1(15), TRUE);
5283 reward = "Á´Ç½ÎÏÃͤ¬²¼¤¬¤Ã¤¿¡£";
5285 reward = "decreasing all stats";
5292 msg_format("%s¤ÎÀ¼¤¬¹ì¤ÅϤä¿:",
5294 msg_format("The voice of %s thunders:",
5297 chaos_patrons[p_ptr->chaos_patron]);
5299 msg_print("¡Ö»à¤Ì¤¬¤è¤¤¡¢²¼Ëͤ衪¡×");
5301 msg_print("'Die, mortal!'");
5304 take_hit(DAMAGE_LOSELIFE, p_ptr->lev * 4, wrath_reason, -1);
5305 for (dummy = 0; dummy < 6; dummy++)
5307 (void)dec_stat(dummy, 10 + randint1(15), FALSE);
5309 activate_hi_summon(py, px, FALSE);
5310 (void)activate_ty_curse(FALSE, &count);
5315 if (buki_motteruka(INVEN_RARM))
5318 if (buki_motteruka(INVEN_LARM) && one_in_(2)) dummy = INVEN_LARM;
5320 else if (buki_motteruka(INVEN_LARM)) dummy = INVEN_LARM;
5322 if (dummy) (void)curse_weapon(FALSE, dummy);
5324 if (one_in_(2)) (void)curse_armor();
5328 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5329 chaos_patrons[p_ptr->chaos_patron]);
5331 msg_format("The voice of %s booms out:",
5332 chaos_patrons[p_ptr->chaos_patron]);
5336 msg_print("¡Ö»à¤ÈÇ˲õ¤³¤½²æ¤¬´î¤Ó¤Ê¤ê¡ª¡×");
5338 msg_print("'Death and destruction! This pleaseth me!'");
5341 (void)destroy_area(py, px, 25, FALSE);
5343 reward = "¥À¥ó¥¸¥ç¥ó¤¬*Ç˲õ*¤µ¤ì¤¿¡£";
5345 reward = "*destruct*ing dungeon";
5350 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5351 chaos_patrons[p_ptr->chaos_patron]);
5353 msg_format("The voice of %s booms out:",
5354 chaos_patrons[p_ptr->chaos_patron]);
5358 msg_print("¡Ö²æ¡¢Æò¤ÎŨ¤òËõ»¦¤»¤ó¡ª¡×");
5360 msg_print("'Let me relieve thee of thine oppressors!'");
5363 (void)symbol_genocide(0, FALSE);
5365 reward = "¥â¥ó¥¹¥¿¡¼¤¬Ëõ»¦¤µ¤ì¤¿¡£";
5367 reward = "genociding monsters";
5372 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5373 chaos_patrons[p_ptr->chaos_patron]);
5375 msg_format("The voice of %s booms out:",
5376 chaos_patrons[p_ptr->chaos_patron]);
5380 msg_print("¡Ö²æ¡¢Æò¤ÎŨ¤òËõ»¦¤»¤ó¡ª¡×");
5382 msg_print("'Let me relieve thee of thine oppressors!'");
5385 (void)mass_genocide(0, FALSE);
5387 reward = "¥â¥ó¥¹¥¿¡¼¤¬Ëõ»¦¤µ¤ì¤¿¡£";
5389 reward = "genociding nearby monsters";
5394 msg_format("%s¤ÎÎϤ¬Å¨¤ò¹¶·â¤¹¤ë¤Î¤ò´¶¤¸¤¿¡ª",
5395 chaos_patrons[p_ptr->chaos_patron]);
5397 msg_format("You can feel the power of %s assault your enemies!",
5398 chaos_patrons[p_ptr->chaos_patron]);
5401 (void)dispel_monsters(p_ptr->lev * 4);
5405 msg_format("%s¤Ï¤¢¤Ê¤¿¤ò̵»ë¤·¤¿¡£",
5406 chaos_patrons[p_ptr->chaos_patron]);
5408 msg_format("%s ignores you.",
5409 chaos_patrons[p_ptr->chaos_patron]);
5415 msg_format("%s¤ÏË«Èþ¤È¤·¤Æ°Ëâ¤Î»È¤¤¤ò¤è¤³¤·¤¿¡ª",chaos_patrons[p_ptr->chaos_patron]);
5417 msg_format("%s rewards you with a demonic servant!",chaos_patrons[p_ptr->chaos_patron]);
5420 if (!summon_specific(-1, py, px, dun_level, SUMMON_DEMON, PM_FORCE_PET))
5422 msg_print("²¿¤â¸½¤ì¤Ê¤«¤Ã¤¿...");
5424 msg_print("Nobody ever turns up...");
5428 reward = "°Ë⤬¥Ú¥Ã¥È¤Ë¤Ê¤Ã¤¿¡£";
5430 reward = "a demonic servant";
5436 msg_format("%s¤ÏË«Èþ¤È¤·¤Æ»È¤¤¤ò¤è¤³¤·¤¿¡ª",chaos_patrons[p_ptr->chaos_patron]);
5438 msg_format("%s rewards you with a servant!",chaos_patrons[p_ptr->chaos_patron]);
5441 if (!summon_specific(-1, py, px, dun_level, 0, PM_FORCE_PET))
5443 msg_print("²¿¤â¸½¤ì¤Ê¤«¤Ã¤¿...");
5445 msg_print("Nobody ever turns up...");
5449 reward = "¥â¥ó¥¹¥¿¡¼¤¬¥Ú¥Ã¥È¤Ë¤Ê¤Ã¤¿¡£";
5451 reward = "a servant";
5457 msg_format("%s¤ÏË«Èþ¤È¤·¤Æ¥¢¥ó¥Ç¥Ã¥É¤Î»È¤¤¤ò¤è¤³¤·¤¿¡£",chaos_patrons[p_ptr->chaos_patron]);
5459 msg_format("%s rewards you with an undead servant!",chaos_patrons[p_ptr->chaos_patron]);
5462 if (!summon_specific(-1, py, px, dun_level, SUMMON_UNDEAD, PM_FORCE_PET))
5464 msg_print("²¿¤â¸½¤ì¤Ê¤«¤Ã¤¿...");
5466 msg_print("Nobody ever turns up...");
5470 reward = "¥¢¥ó¥Ç¥Ã¥É¤¬¥Ú¥Ã¥È¤Ë¤Ê¤Ã¤¿¡£";
5472 reward = "an undead servant";
5478 msg_format("%s¤ÎÀ¼¤¬¤É¤â¤Ã¤¿:",
5480 msg_format("The voice of %s stammers:",
5483 chaos_patrons[p_ptr->chaos_patron]);
5485 msg_format("¡Ö¤¢¡¼¡¢¤¢¡¼¡¢Åú¤¨¤Ï %d/%d¡£¼ÁÌä¤Ï²¿¡©¡×", type, effect);
5487 msg_format("'Uh... uh... the answer's %d/%d, what's the question?'", type, effect);
5495 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, format("¥Ñ¥È¥í¥ó¤ÎÊó½·¤Ç%s", reward));
5497 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, format("The patron rewards you with %s.", reward));
5504 * old -- from PsiAngband.
5506 bool tgt_pt(int *x_ptr, int *y_ptr)
5510 bool success = FALSE;
5515 get_screen_size(&wid, &hgt);
5521 msg_print("¾ì½ê¤òÁª¤ó¤Ç¥¹¥Ú¡¼¥¹¥¡¼¤ò²¡¤·¤Æ²¼¤µ¤¤¡£");
5523 msg_print("Select a point and press space.");
5525 msg_flag = FALSE; /* prevents "-more-" message. */
5527 while ((ch != ESCAPE) && !success)
5529 bool move_fast = FALSE;
5531 move_cursor_relative(y, x);
5543 if (player_bold(y, x)) ch = 0;
5546 else success = TRUE;
5550 /* Look up the direction */
5551 d = get_keymap_dir(ch);
5553 /* XTRA HACK MOVEFAST */
5554 if (isupper(ch)) move_fast = TRUE;
5556 /* Handle "direction" */
5562 /* XTRA HACK MOVEFAST */
5565 int mag = MIN(wid / 2, hgt / 2);
5575 /* Do not move horizontally if unnecessary */
5576 if (((x < panel_col_min + wid / 2) && (dx > 0)) ||
5577 ((x > panel_col_min + wid / 2) && (dx < 0)))
5582 /* Do not move vertically if unnecessary */
5583 if (((y < panel_row_min + hgt / 2) && (dy > 0)) ||
5584 ((y > panel_row_min + hgt / 2) && (dy < 0)))
5589 /* Apply the motion */
5590 if ((y >= panel_row_min + hgt) || (y < panel_row_min) ||
5591 (x >= panel_col_min + wid) || (x < panel_col_min))
5593 /* if (change_panel(dy, dx)) target_set_prepare(mode); */
5594 change_panel(dy, dx);
5597 /* Slide into legality */
5598 if (x >= cur_wid-1) x = cur_wid - 2;
5599 else if (x <= 0) x = 1;
5601 /* Slide into legality */
5602 if (y >= cur_hgt-1) y = cur_hgt- 2;
5603 else if (y <= 0) y = 1;
5610 /* Clear the top line */
5613 /* Recenter the map around the player */
5617 p_ptr->update |= (PU_MONSTERS);
5620 p_ptr->redraw |= (PR_MAP);
5623 p_ptr->window |= (PW_OVERHEAD);
5634 bool get_hack_dir(int *dp)
5644 /* Global direction */
5647 /* (No auto-targeting) */
5649 /* Ask until satisfied */
5652 /* Choose a prompt */
5656 p = "Êý¸þ ('*'¤Ç¥¿¡¼¥²¥Ã¥ÈÁªÂò, ESC¤ÇÃæÃÇ)? ";
5658 p = "Direction ('*' to choose a target, Escape to cancel)? ";
5665 p = "Êý¸þ ('5'¤Ç¥¿¡¼¥²¥Ã¥È¤Ø, '*'¤Ç¥¿¡¼¥²¥Ã¥ÈºÆÁªÂò, ESC¤ÇÃæÃÇ)? ";
5667 p = "Direction ('5' for target, '*' to re-target, Escape to cancel)? ";
5672 /* Get a command (or Cancel) */
5673 if (!get_com(p, &command, TRUE)) break;
5677 if (command == '\r') command = 't';
5680 /* Convert various keys to "standard" keys */
5683 /* Use current target */
5694 /* Set new target */
5699 if (target_set(TARGET_KILL)) dir = 5;
5705 /* Look up the direction */
5706 dir = get_keymap_dir(command);
5712 /* Verify requested targets */
5713 if ((dir == 5) && !target_okay()) dir = 0;
5720 if (!dir) return (FALSE);
5722 /* Save the direction */
5725 /* Check for confusion */
5726 if (p_ptr->confused)
5729 /* Random direction */
5730 dir = ddd[randint0(8)];
5733 /* Notice confusion */
5734 if (command_dir != dir)
5738 msg_print("¤¢¤Ê¤¿¤Ïº®Í𤷤Ƥ¤¤ë¡£");
5740 msg_print("You are confused.");
5745 /* Save direction */
5748 /* A "valid" direction was entered */
5754 * ¥¨¥Í¥ë¥®¡¼¤ÎÁý²ÃÎÌ10d5¤ò®¤¯·×»»¤¹¤ë¤¿¤á¤Î´Ø¿ô
5757 #define Go_no_JuuJou 5*5*5*5*5*5*5*5*5*5
5759 s16b gain_energy(void)
5762 s32b energy_result = 10;
5765 tmp = randint0(Go_no_JuuJou);
5767 for (i = 0; i < 9; i ++){
5768 energy_result += tmp % 5;
5772 return (s16b)(energy_result + tmp);
5779 s16b bow_energy(int sval)
5783 /* Analyze the launcher */
5786 /* Sling and ammo */
5793 /* Short Bow and Arrow */
5800 /* Long Bow and Arrow */
5807 /* Bow of irresponsiblity and Arrow */
5814 /* Light Crossbow and Bolt */
5821 /* Heavy Crossbow and Bolt */
5836 int bow_tmul(int sval)
5840 /* Analyze the launcher */
5843 /* Sling and ammo */
5850 /* Short Bow and Arrow */
5857 /* Long Bow and Arrow */
5864 /* Bow of irresponsiblity and Arrow */
5871 /* Light Crossbow and Bolt */
5878 /* Heavy Crossbow and Bolt */
5890 * Return alignment title
5892 cptr your_alignment(void)
5895 if (p_ptr->align > 150) return "ÂçÁ±";
5896 else if (p_ptr->align > 50) return "ÃæÁ±";
5897 else if (p_ptr->align > 10) return "¾®Á±";
5898 else if (p_ptr->align > -11) return "ÃæΩ";
5899 else if (p_ptr->align > -51) return "¾®°";
5900 else if (p_ptr->align > -151) return "Ãæ°";
5903 if (p_ptr->align > 150) return "Lawful";
5904 else if (p_ptr->align > 50) return "Good";
5905 else if (p_ptr->align > 10) return "Neutral Good";
5906 else if (p_ptr->align > -11) return "Neutral";
5907 else if (p_ptr->align > -51) return "Neutral Evil";
5908 else if (p_ptr->align > -151) return "Evil";
5909 else return "Chaotic";
5915 * Return proficiency level of weapons and misc. skills (except riding)
5917 int weapon_exp_level(int weapon_exp)
5919 if (weapon_exp < WEAPON_EXP_BEGINNER) return EXP_LEVEL_UNSKILLED;
5920 else if (weapon_exp < WEAPON_EXP_SKILLED) return EXP_LEVEL_BEGINNER;
5921 else if (weapon_exp < WEAPON_EXP_EXPERT) return EXP_LEVEL_SKILLED;
5922 else if (weapon_exp < WEAPON_EXP_MASTER) return EXP_LEVEL_EXPERT;
5923 else return EXP_LEVEL_MASTER;
5928 * Return proficiency level of riding
5930 int riding_exp_level(int riding_exp)
5932 if (riding_exp < RIDING_EXP_BEGINNER) return EXP_LEVEL_UNSKILLED;
5933 else if (riding_exp < RIDING_EXP_SKILLED) return EXP_LEVEL_BEGINNER;
5934 else if (riding_exp < RIDING_EXP_EXPERT) return EXP_LEVEL_SKILLED;
5935 else if (riding_exp < RIDING_EXP_MASTER) return EXP_LEVEL_EXPERT;
5936 else return EXP_LEVEL_MASTER;
5941 * Return proficiency level of spells
5943 int spell_exp_level(int spell_exp)
5945 if (spell_exp < SPELL_EXP_BEGINNER) return EXP_LEVEL_UNSKILLED;
5946 else if (spell_exp < SPELL_EXP_SKILLED) return EXP_LEVEL_BEGINNER;
5947 else if (spell_exp < SPELL_EXP_EXPERT) return EXP_LEVEL_SKILLED;
5948 else if (spell_exp < SPELL_EXP_MASTER) return EXP_LEVEL_EXPERT;
5949 else return EXP_LEVEL_MASTER;