3 /* Purpose: effects of various "objects" */
6 * Copyright (c) 1989 James E. Wilson, Robert A. Koeneke
8 * This software may be copied and distributed for educational, research, and
9 * not for profit purposes provided that this copyright and statement are
10 * included in all such copies.
15 #define REWARD_CHANCE 10
19 * Advance experience levels and print experience
21 void check_experience(void)
24 bool level_reward = FALSE;
25 bool level_mutation = FALSE;
26 bool level_inc_stat = FALSE;
27 bool android = (p_ptr->prace == RACE_ANDROID ? TRUE : FALSE);
30 /* Note current level */
33 /* Hack -- lower limit */
34 if (p_ptr->exp < 0) p_ptr->exp = 0;
36 /* Hack -- lower limit */
37 if (p_ptr->max_exp < 0) p_ptr->max_exp = 0;
39 /* Hack -- upper limit */
40 if (p_ptr->exp > PY_MAX_EXP) p_ptr->exp = PY_MAX_EXP;
42 /* Hack -- upper limit */
43 if (p_ptr->max_exp > PY_MAX_EXP) p_ptr->max_exp = PY_MAX_EXP;
45 /* Hack -- maintain "max" experience */
46 if (p_ptr->exp > p_ptr->max_exp) p_ptr->max_exp = p_ptr->exp;
48 /* Redraw experience */
49 p_ptr->redraw |= (PR_EXP);
55 /* Lose levels while possible */
56 while ((p_ptr->lev > 1) &&
57 (p_ptr->exp < ((android ? player_exp_a : player_exp)[p_ptr->lev - 2] * p_ptr->expfact / 100L)))
63 /* Update some stuff */
64 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
66 /* Redraw some stuff */
67 p_ptr->redraw |= (PR_LEV | PR_TITLE);
70 p_ptr->window |= (PW_PLAYER);
77 /* Gain levels while possible */
78 while ((p_ptr->lev < PY_MAX_LEVEL) &&
79 (p_ptr->exp >= ((android ? player_exp_a : player_exp)[p_ptr->lev-1] * p_ptr->expfact / 100L)))
85 /* Save the highest level */
86 if (p_ptr->lev > p_ptr->max_plv)
88 p_ptr->max_plv = p_ptr->lev;
90 if ((p_ptr->pclass == CLASS_CHAOS_WARRIOR) ||
91 (p_ptr->muta2 & MUT2_CHAOS_GIFT))
95 if (p_ptr->prace == RACE_BEASTMAN)
97 if (one_in_(5)) level_mutation = TRUE;
99 level_inc_stat = TRUE;
101 do_cmd_write_nikki(NIKKI_LEVELUP, p_ptr->lev, NULL);
109 msg_format("¥ì¥Ù¥ë %d ¤Ë¤è¤¦¤³¤½¡£", p_ptr->lev);
111 msg_format("Welcome to level %d.", p_ptr->lev);
114 /* Update some stuff */
115 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
117 /* Redraw some stuff */
118 p_ptr->redraw |= (PR_LEV | PR_TITLE);
121 p_ptr->window |= (PW_PLAYER | PW_SPELL);
134 gain_level_reward(0);
135 level_reward = FALSE;
140 if(!(p_ptr->max_plv % 10))
150 cnv_stat(p_ptr->stat_max[0], tmp);
151 prt(format(" a) ÏÓÎÏ (¸½ºßÃÍ %s)", tmp), 2, 14);
152 cnv_stat(p_ptr->stat_max[1], tmp);
153 prt(format(" b) ÃÎǽ (¸½ºßÃÍ %s)", tmp), 3, 14);
154 cnv_stat(p_ptr->stat_max[2], tmp);
155 prt(format(" c) ¸¤µ (¸½ºßÃÍ %s)", tmp), 4, 14);
156 cnv_stat(p_ptr->stat_max[3], tmp);
157 prt(format(" d) ´ïÍÑ (¸½ºßÃÍ %s)", tmp), 5, 14);
158 cnv_stat(p_ptr->stat_max[4], tmp);
159 prt(format(" e) ÂÑµ× (¸½ºßÃÍ %s)", tmp), 6, 14);
160 cnv_stat(p_ptr->stat_max[5], tmp);
161 prt(format(" f) Ì¥ÎÏ (¸½ºßÃÍ %s)", tmp), 7, 14);
163 prt(" ¤É¤ÎǽÎÏÃͤò¾å¤²¤Þ¤¹¤«¡©", 1, 14);
165 cnv_stat(p_ptr->stat_max[0], tmp);
166 prt(format(" a) Str (cur %s)", tmp), 2, 14);
167 cnv_stat(p_ptr->stat_max[1], tmp);
168 prt(format(" b) Int (cur %s)", tmp), 3, 14);
169 cnv_stat(p_ptr->stat_max[2], tmp);
170 prt(format(" c) Wis (cur %s)", tmp), 4, 14);
171 cnv_stat(p_ptr->stat_max[3], tmp);
172 prt(format(" d) Dex (cur %s)", tmp), 5, 14);
173 cnv_stat(p_ptr->stat_max[4], tmp);
174 prt(format(" e) Con (cur %s)", tmp), 6, 14);
175 cnv_stat(p_ptr->stat_max[5], tmp);
176 prt(format(" f) Chr (cur %s)", tmp), 7, 14);
178 prt(" Which stat do you want to raise?", 1, 14);
183 if ((choice >= 'a') && (choice <= 'f')) break;
185 for(n = 0; n < 6; n++)
186 if (n != choice - 'a')
189 if (get_check("¤è¤í¤·¤¤¤Ç¤¹¤«¡©")) break;
191 if (get_check("Are you sure? ")) break;
194 do_inc_stat(choice - 'a');
197 else if(!(p_ptr->max_plv % 2))
198 do_inc_stat(randint0(6));
204 msg_print("¤¢¤Ê¤¿¤ÏÊѤï¤Ã¤¿µ¤¤¬¤¹¤ë...");
206 msg_print("You feel different...");
209 (void)gain_random_mutation(0);
210 level_mutation = FALSE;
213 /* Update some stuff */
214 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
216 /* Redraw some stuff */
217 p_ptr->redraw |= (PR_LEV | PR_TITLE);
220 p_ptr->window |= (PW_PLAYER | PW_SPELL);
229 * Hack -- Return the "automatic coin type" of a monster race
230 * Used to allocate proper treasure when "Creeping coins" die
232 * XXX XXX XXX Note the use of actual "monster names"
234 static int get_coin_type(int r_idx)
236 monster_race *r_ptr = &r_info[r_idx];
238 /* Analyze "coin" monsters */
239 if (r_ptr->d_char == '$')
241 /* Look for textual clues */
244 case MON_COPPER_COINS: return (2);
245 case MON_SILVER_COINS: return (5);
246 case MON_GOLD_COINS: return (10);
247 case MON_MITHRIL_COINS: return (16);
248 case MON_ADAMANT_COINS: return (17);
258 * Hack -- determine if a template is Cloak
260 static bool kind_is_cloak(int k_idx)
262 object_kind *k_ptr = &k_info[k_idx];
264 /* Analyze the item type */
265 if (k_ptr->tval == TV_CLOAK)
270 /* Assume not good */
276 * Hack -- determine if a template is Polearm
278 static bool kind_is_polearm(int k_idx)
280 object_kind *k_ptr = &k_info[k_idx];
282 /* Analyze the item type */
283 if (k_ptr->tval == TV_POLEARM)
288 /* Assume not good */
294 * Hack -- determine if a template is Sword
296 static bool kind_is_sword(int k_idx)
298 object_kind *k_ptr = &k_info[k_idx];
300 /* Analyze the item type */
301 if ((k_ptr->tval == TV_SWORD) && (k_ptr->sval > 2))
306 /* Assume not good */
312 * Hack -- determine if a template is Book
314 static bool kind_is_book(int k_idx)
316 object_kind *k_ptr = &k_info[k_idx];
318 /* Analyze the item type */
319 if ((k_ptr->tval >= TV_LIFE_BOOK) && (k_ptr->tval <= TV_DAEMON_BOOK))
324 /* Assume not good */
330 * Hack -- determine if a template is Good book
332 static bool kind_is_good_book(int k_idx)
334 object_kind *k_ptr = &k_info[k_idx];
336 /* Analyze the item type */
337 if ((k_ptr->tval >= TV_LIFE_BOOK) && (k_ptr->tval <= TV_DAEMON_BOOK) && (k_ptr->tval != TV_ARCANE_BOOK) && (k_ptr->sval > 1))
342 /* Assume not good */
348 * Hack -- determine if a template is Armor
350 static bool kind_is_armor(int k_idx)
352 object_kind *k_ptr = &k_info[k_idx];
354 /* Analyze the item type */
355 if (k_ptr->tval == TV_HARD_ARMOR)
360 /* Assume not good */
366 * Check for "Quest" completion when a quest monster is killed or charmed.
368 void check_quest_completion(monster_type *m_ptr)
370 int i, j, y, x, ny, nx, i2, j2;
374 bool create_stairs = FALSE;
380 /* Get the location */
385 quest_num = p_ptr->inside_quest;
387 /* Search for an active quest on this dungeon level */
390 for (i = max_quests - 1; i > 0; i--)
392 /* Quest is not active */
393 if (quest[i].status != QUEST_STATUS_TAKEN)
396 /* Quest is not a dungeon quest */
397 if (quest[i].flags & QUEST_FLAG_PRESET)
400 /* Quest is not on this level */
401 if ((quest[i].level != dun_level) &&
402 (quest[i].type != QUEST_TYPE_KILL_ANY_LEVEL))
405 /* Not a "kill monster" quest */
406 if ((quest[i].type == QUEST_TYPE_FIND_ARTIFACT) ||
407 (quest[i].type == QUEST_TYPE_FIND_EXIT))
410 /* Interesting quest */
411 if ((quest[i].type == QUEST_TYPE_KILL_NUMBER) ||
412 (quest[i].type == QUEST_TYPE_KILL_ALL))
415 /* Interesting quest */
416 if (((quest[i].type == QUEST_TYPE_KILL_LEVEL) ||
417 (quest[i].type == QUEST_TYPE_KILL_ANY_LEVEL) ||
418 (quest[i].type == QUEST_TYPE_RANDOM)) &&
419 (quest[i].r_idx == m_ptr->r_idx))
426 /* Handle the current quest */
427 if (quest_num && (quest[quest_num].status == QUEST_STATUS_TAKEN))
432 switch (quest[i].type)
434 case QUEST_TYPE_KILL_NUMBER:
438 if (quest[i].cur_num >= quest[i].num_mon)
440 if (record_fix_quest) do_cmd_write_nikki(NIKKI_FIX_QUEST_C, i, NULL);
441 /* completed quest */
442 quest[i].status = QUEST_STATUS_COMPLETED;
443 quest[i].complev = (byte)p_ptr->lev;
445 if (!(quest[i].flags & QUEST_FLAG_SILENT))
448 msg_print("¥¯¥¨¥¹¥È¤òãÀ®¤·¤¿¡ª");
450 msg_print("You just completed your quest!");
456 quest[i].cur_num = 0;
460 case QUEST_TYPE_KILL_ALL:
464 if (!is_hostile(m_ptr)) break;
466 /* Count all hostile monsters */
467 for (i2 = 0; i2 < cur_wid; ++i2)
468 for (j2 = 0; j2 < cur_hgt; j2++)
469 if (cave[j2][i2].m_idx > 0)
470 if (is_hostile(&m_list[cave[j2][i2].m_idx]))
473 if ((number_mon - 1) == 0)
475 if (record_fix_quest) do_cmd_write_nikki(NIKKI_FIX_QUEST_C, i, NULL);
477 if (quest[i].flags & QUEST_FLAG_SILENT)
479 quest[i].status = QUEST_STATUS_FINISHED;
483 quest[i].status = QUEST_STATUS_COMPLETED;
484 quest[i].complev = (byte)p_ptr->lev;
486 msg_print("¥¯¥¨¥¹¥È¤òãÀ®¤·¤¿¡ª");
488 msg_print("You just completed your quest!");
496 case QUEST_TYPE_KILL_LEVEL:
497 case QUEST_TYPE_RANDOM:
499 /* Only count valid monsters */
500 if (quest[i].r_idx != m_ptr->r_idx)
505 if (quest[i].cur_num >= quest[i].max_num)
507 if (record_fix_quest && (quest[i].type == QUEST_TYPE_KILL_LEVEL)) do_cmd_write_nikki(NIKKI_FIX_QUEST_C, i, NULL);
508 if (record_rand_quest && (quest[i].type == QUEST_TYPE_RANDOM)) do_cmd_write_nikki(NIKKI_RAND_QUEST_C, i, NULL);
509 /* completed quest */
510 quest[i].status = QUEST_STATUS_COMPLETED;
511 quest[i].complev = (byte)p_ptr->lev;
512 if (!(quest[i].flags & QUEST_FLAG_PRESET))
514 create_stairs = TRUE;
515 p_ptr->inside_quest = 0;
518 if (!quest[i].flags & QUEST_FLAG_SILENT)
521 msg_print("¥¯¥¨¥¹¥È¤òãÀ®¤·¤¿¡ª");
523 msg_print("You just completed your quest!");
529 /* Finish the two main quests without rewarding */
530 if ((i == QUEST_OBERON) || (i == QUEST_SERPENT))
532 quest[i].status = QUEST_STATUS_FINISHED;
535 if (quest[i].type == QUEST_TYPE_RANDOM)
538 quest[i].status = QUEST_STATUS_FINISHED;
543 case QUEST_TYPE_KILL_ANY_LEVEL:
546 if (quest[i].cur_num >= quest[i].max_num)
548 if (record_fix_quest) do_cmd_write_nikki(NIKKI_FIX_QUEST_C, i, NULL);
549 /* completed quest */
550 quest[i].status = QUEST_STATUS_COMPLETED;
551 quest[i].complev = (byte)p_ptr->lev;
553 if (!quest[i].flags & QUEST_FLAG_SILENT)
556 msg_print("¥¯¥¨¥¹¥È¤òãÀ®¤·¤¿¡ª");
558 msg_print("You just completed your quest!");
563 quest[i].cur_num = 0;
570 /* Create a magical staircase */
574 while (cave_perma_bold(y, x) || cave[y][x].o_idx)
576 /* Pick a location */
577 scatter(&ny, &nx, y, x, 1, 0);
583 /* Explain the staircase */
585 msg_print("ËâË¡¤Î³¬Ãʤ¬¸½¤ì¤¿...");
587 msg_print("A magical staircase appears...");
591 /* Create stairs down */
592 cave_set_feat(y, x, FEAT_MORE);
594 /* Delete invisible trap */
595 cave[y][x].info &= ~(CAVE_TRAP);
597 /* Remember to update everything */
598 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MONSTERS);
606 for (j = 0; j < (dun_level / 15)+1; j++)
608 /* Get local object */
611 /* Wipe the object */
614 /* Make a great object */
615 make_object(q_ptr, TRUE, TRUE);
617 /* Drop it in the dungeon */
618 (void)drop_near(q_ptr, -1, y, x);
624 * Handle the "death" of a monster.
626 * Disperse treasures centered at the monster location based on the
627 * various flags contained in the monster flags fields.
629 * Check for "Quest" completion when a quest monster is killed.
631 * Note that only the player can induce "monster_death()" on Uniques.
632 * Thus (for now) all Quest monsters should be Uniques.
634 * Note that monsters can now carry objects, and when a monster dies,
635 * it drops all of its objects, which may disappear in crowded rooms.
637 void monster_death(int m_idx, bool drop_item)
646 monster_type *m_ptr = &m_list[m_idx];
648 monster_race *r_ptr = &r_info[m_ptr->r_idx];
650 bool visible = (m_ptr->ml || (r_ptr->flags1 & RF1_UNIQUE));
652 bool good = (r_ptr->flags1 & RF1_DROP_GOOD) ? TRUE : FALSE;
653 bool great = (r_ptr->flags1 & RF1_DROP_GREAT) ? TRUE : FALSE;
655 bool do_gold = (!(r_ptr->flags1 & RF1_ONLY_ITEM));
656 bool do_item = (!(r_ptr->flags1 & RF1_ONLY_GOLD));
658 int force_coin = get_coin_type(m_ptr->r_idx);
664 if (world_monster) world_monster = FALSE;
666 /* Notice changes in view */
667 if (r_ptr->flags7 & (RF7_HAS_LITE_1 | RF7_HAS_LITE_2 | RF7_SELF_LITE_1 | RF7_SELF_LITE_2))
669 /* Update some things */
670 p_ptr->update |= (PU_MON_LITE);
673 /* Get the location */
677 if (m_ptr->smart & SM_CLONED)
680 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
684 monster_desc(m_name, m_ptr, 0x08);
685 do_cmd_write_nikki(NIKKI_NAMED_PET, 3, m_name);
688 /* Let monsters explode! */
689 for (i = 0; i < 4; i++)
691 if ((r_ptr->blow[i].method == RBM_EXPLODE) || (m_ptr->r_idx == MON_ROLENTO))
693 int flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
694 int typ = GF_MISSILE;
695 int d_dice = r_ptr->blow[i].d_dice;
696 int d_side = r_ptr->blow[i].d_side;
697 int damage = damroll(d_dice, d_side);
699 switch (r_ptr->blow[i].effect)
701 case RBE_HURT: typ = GF_MISSILE; break;
702 case RBE_POISON: typ = GF_POIS; break;
703 case RBE_UN_BONUS: typ = GF_DISENCHANT; break;
704 case RBE_UN_POWER: typ = GF_MISSILE; break; /* ToDo: Apply the correct effects */
705 case RBE_EAT_GOLD: typ = GF_MISSILE; break;
706 case RBE_EAT_ITEM: typ = GF_MISSILE; break;
707 case RBE_EAT_FOOD: typ = GF_MISSILE; break;
708 case RBE_EAT_LITE: typ = GF_MISSILE; break;
709 case RBE_ACID: typ = GF_ACID; break;
710 case RBE_ELEC: typ = GF_ELEC; break;
711 case RBE_FIRE: typ = GF_FIRE; break;
712 case RBE_COLD: typ = GF_COLD; break;
713 case RBE_BLIND: typ = GF_MISSILE; break;
714 case RBE_CONFUSE: typ = GF_CONFUSION; break;
715 case RBE_TERRIFY: typ = GF_MISSILE; break;
716 case RBE_PARALYZE: typ = GF_MISSILE; break;
717 case RBE_LOSE_STR: typ = GF_MISSILE; break;
718 case RBE_LOSE_DEX: typ = GF_MISSILE; break;
719 case RBE_LOSE_CON: typ = GF_MISSILE; break;
720 case RBE_LOSE_INT: typ = GF_MISSILE; break;
721 case RBE_LOSE_WIS: typ = GF_MISSILE; break;
722 case RBE_LOSE_CHR: typ = GF_MISSILE; break;
723 case RBE_LOSE_ALL: typ = GF_MISSILE; break;
724 case RBE_SHATTER: typ = GF_ROCKET; break;
725 case RBE_EXP_10: typ = GF_MISSILE; break;
726 case RBE_EXP_20: typ = GF_MISSILE; break;
727 case RBE_EXP_40: typ = GF_MISSILE; break;
728 case RBE_EXP_80: typ = GF_MISSILE; break;
729 case RBE_DISEASE: typ = GF_POIS; break;
730 case RBE_TIME: typ = GF_TIME; break;
731 case RBE_EXP_VAMP: typ = GF_MISSILE; break;
732 case RBE_DR_MANA: typ = GF_MANA; break;
733 case RBE_SUPERHURT: typ = GF_MISSILE; break;
735 if (m_ptr->r_idx == MON_ROLENTO)
738 damage = damroll(20,10);
741 project(m_idx, 3, y, x, damage, typ, flg, -1);
746 if (m_ptr->mflag2 & MFLAG_CHAMELEON)
748 choose_new_monster(m_idx, TRUE, MON_CHAMELEON);
749 r_ptr = &r_info[m_ptr->r_idx];
752 /* Check for quest completion */
753 check_quest_completion(m_ptr);
755 /* Handle the possibility of player vanquishing arena combatant -KMW- */
756 if (p_ptr->inside_arena && !is_pet(m_ptr))
760 /* Extract monster name */
761 monster_desc(m_name, m_ptr, 0);
763 p_ptr->exit_bldg = TRUE;
765 if (p_ptr->arena_number > MAX_ARENA_MONS)
768 msg_print("ÁÇÀ²¤é¤·¤¤¡ª·¯¤³¤½¿¿¤Î¾¡Íø¼Ô¤À¡£");
770 msg_print("You are a Genuine Champion!");
776 msg_print("¾¡Íø¡ª¥Á¥ã¥ó¥Ô¥ª¥ó¤Ø¤ÎÆ»¤ò¿Ê¤ó¤Ç¤¤¤ë¡£");
778 msg_print("Victorious! You're on your way to becoming Champion.");
782 if (arena_shouhin[p_ptr->arena_number])
784 /* Get local object */
787 /* Prepare to make a Blade of Chaos */
788 object_prep(q_ptr, lookup_kind(k_info[arena_shouhin[p_ptr->arena_number]].tval, k_info[arena_shouhin[p_ptr->arena_number]].sval));
790 apply_magic(q_ptr, object_level, FALSE, FALSE, FALSE, FALSE);
792 /* Drop it in the dungeon */
793 (void)drop_near(q_ptr, -1, y, x);
796 if (p_ptr->arena_number > MAX_ARENA_MONS) p_ptr->arena_number++;
797 p_ptr->arena_number++;
798 if (record_arena) do_cmd_write_nikki(NIKKI_ARENA, p_ptr->arena_number, m_name);
801 if (m_idx == p_ptr->riding)
803 if (rakuba(-1, FALSE))
806 msg_print("ÃÏÌ̤ËÍî¤È¤µ¤ì¤¿¡£");
808 msg_print("You have fallen from your riding pet.");
813 /* Drop a dead corpse? */
814 if (one_in_(r_ptr->flags1 & RF1_UNIQUE ? 1 : 4) &&
815 ((r_ptr->flags9 & RF9_DROP_CORPSE) ||
816 (r_ptr->flags9 & RF9_DROP_SKELETON)) &&
817 !(p_ptr->inside_arena || p_ptr->inside_battle || (m_ptr->smart & SM_CLONED) || ((m_ptr->r_idx == today_mon) && is_pet(m_ptr))))
819 /* Assume skeleton */
823 * We cannot drop a skeleton? Note, if we are in this check,
824 * we *know* we can drop at least a corpse or a skeleton
826 if (!(r_ptr->flags9 & RF9_DROP_SKELETON))
828 else if ((r_ptr->flags9 & RF9_DROP_CORPSE) && (r_ptr->flags1 && RF1_UNIQUE))
831 /* Else, a corpse is more likely unless we did a "lot" of damage */
832 else if (r_ptr->flags9 & RF9_DROP_CORPSE)
834 /* Lots of damage in one blow */
835 if ((0 - ((m_ptr->maxhp) / 4)) > m_ptr->hp)
837 if (one_in_(5)) corpse = TRUE;
841 if (!one_in_(5)) corpse = TRUE;
845 /* Get local object */
848 /* Prepare to make an object */
849 object_prep(q_ptr, lookup_kind(TV_CORPSE, (corpse ? SV_CORPSE : SV_SKELETON)));
851 apply_magic(q_ptr, object_level, FALSE, FALSE, FALSE, FALSE);
853 q_ptr->pval = m_ptr->r_idx;
855 /* Drop it in the dungeon */
856 (void)drop_near(q_ptr, -1, y, x);
859 /* Drop objects being carried */
860 monster_drop_carried_objects(m_ptr);
863 * Mega^3-hack: killing a 'Warrior of the Dawn' is likely to
864 * spawn another in the fallen one's place!
866 if (m_ptr->r_idx == MON_DAWN &&
867 !(p_ptr->inside_arena || p_ptr->inside_battle))
871 int wy = py, wx = px;
873 bool pet = is_pet(m_ptr);
877 scatter(&wy, &wx, py, px, 20, 0);
879 while (!(in_bounds(wy, wx) && cave_floor_bold(wy, wx)) && --attempts);
883 if (summon_specific((pet ? -1 : 0), wy, wx, 100, SUMMON_DAWN, FALSE, is_friendly(m_ptr), pet, FALSE, FALSE))
885 if (player_can_see_bold(wy, wx))
887 msg_print("¿·¤¿¤ÊÀï»Î¤¬¸½¤ì¤¿¡ª");
889 msg_print("A new warrior steps forth!");
897 /* Pink horrors are replaced with 2 Blue horrors */
898 else if (m_ptr->r_idx == MON_PINK_HORROR &&
899 !(p_ptr->inside_arena || p_ptr->inside_battle))
903 for (i = 0; i < 2; i++)
906 bool pet = is_pet(m_ptr);
908 if (summon_specific((pet ? -1 : 0), wy, wx, 100, SUMMON_BLUE_HORROR, FALSE, is_friendly(m_ptr), pet, FALSE, FALSE))
910 if (player_can_see_bold(wy, wx))
917 msg_print("¥Ô¥ó¥¯¡¦¥Û¥é¡¼¤ÏʬÎö¤·¤¿¡ª");
919 msg_print("The Pink horror divides!");
923 /* One more ultra-hack: An Unmaker goes out with a big bang! */
924 else if (m_ptr->r_idx == MON_UNMAKER)
927 int flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
928 (void)project(m_idx, 6, y, x, 100, GF_CHAOS, flg, -1);
931 /* Bloodletters of Khorne may drop a blade of chaos */
932 else if (m_ptr->r_idx == MON_BLOODLETTER &&
934 (randint1(100) < 15) &&
935 !(p_ptr->inside_arena || p_ptr->inside_battle))
937 /* Get local object */
940 /* Prepare to make a Blade of Chaos */
941 object_prep(q_ptr, lookup_kind(TV_SWORD, SV_BLADE_OF_CHAOS));
943 apply_magic(q_ptr, object_level, FALSE, FALSE, FALSE, FALSE);
945 /* Drop it in the dungeon */
946 (void)drop_near(q_ptr, -1, y, x);
949 else if (m_ptr->r_idx == MON_RAAL &&
951 !(p_ptr->inside_arena || p_ptr->inside_battle))
953 /* Get local object */
956 /* Wipe the object */
959 /* Activate restriction */
960 if ((dun_level > 49) && one_in_(5))
961 get_obj_num_hook = kind_is_good_book;
963 get_obj_num_hook = kind_is_book;
965 /* Prepare allocation table */
968 /* Make a great object */
969 make_object(q_ptr, FALSE, FALSE);
971 /* Drop it in the dungeon */
972 (void)drop_near(q_ptr, -1, y, x);
975 else if (m_ptr->r_idx == MON_B_DEATH_SWORD &&
976 !(p_ptr->inside_arena || p_ptr->inside_battle))
978 /* Get local object */
981 /* Prepare to make a Blade of Chaos */
982 object_prep(q_ptr, lookup_kind(TV_SWORD, randint1(2)));
984 /* Drop it in the dungeon */
985 (void)drop_near(q_ptr, -1, y, x);
988 else if ((r_ptr->d_char == '|') && !(m_ptr->r_idx == MON_STORMBRINGER) &&
989 !(p_ptr->inside_arena || p_ptr->inside_battle))
991 /* Get local object */
994 /* Wipe the object */
997 /* Activate restriction */
998 get_obj_num_hook = kind_is_sword;
1000 /* Prepare allocation table */
1003 /* Make a great object */
1004 make_object(q_ptr, FALSE, FALSE);
1006 /* Drop it in the dungeon */
1007 (void)drop_near(q_ptr, -1, y, x);
1010 else if ((r_ptr->d_char == '(') && (dun_level > 0) &&
1011 !(p_ptr->inside_arena || p_ptr->inside_battle))
1013 /* Get local object */
1016 /* Wipe the object */
1019 /* Activate restriction */
1020 get_obj_num_hook = kind_is_cloak;
1022 /* Prepare allocation table */
1025 /* Make a great object */
1026 make_object(q_ptr, FALSE, FALSE);
1028 /* Drop it in the dungeon */
1029 (void)drop_near(q_ptr, -1, y, x);
1032 else if ((r_ptr->d_char == '/') && (dun_level > 4) &&
1033 !(p_ptr->inside_arena || p_ptr->inside_battle))
1035 /* Get local object */
1038 /* Wipe the object */
1041 /* Activate restriction */
1042 get_obj_num_hook = kind_is_polearm;
1044 /* Prepare allocation table */
1047 /* Make a great object */
1048 make_object(q_ptr, FALSE, FALSE);
1050 /* Drop it in the dungeon */
1051 (void)drop_near(q_ptr, -1, y, x);
1054 else if ((r_ptr->d_char == '[') && (dun_level > 19) &&
1055 !(p_ptr->inside_arena || p_ptr->inside_battle))
1057 /* Get local object */
1060 /* Wipe the object */
1063 /* Activate restriction */
1064 get_obj_num_hook = kind_is_armor;
1066 /* Prepare allocation table */
1069 /* Make a great object */
1070 make_object(q_ptr, FALSE, FALSE);
1072 /* Drop it in the dungeon */
1073 (void)drop_near(q_ptr, -1, y, x);
1076 else if ((m_ptr->r_idx == MON_A_GOLD || (m_ptr->r_idx == MON_A_SILVER && !((r_ptr->r_pkills+1)%5))) && !(p_ptr->inside_arena || p_ptr->inside_battle))
1078 /* Get local object */
1081 /* Prepare to make a Blade of Chaos */
1082 object_prep(q_ptr, lookup_kind(TV_CHEST, 50));
1084 apply_magic(q_ptr, object_level, FALSE, FALSE, FALSE, FALSE);
1086 /* Drop it in the dungeon */
1087 (void)drop_near(q_ptr, -1, y, x);
1089 /* Mega-Hack -- drop "winner" treasures */
1092 if (m_ptr->r_idx == MON_SERPENT)
1095 /* Get local object */
1098 /* Mega-Hack -- Prepare to make "Grond" */
1099 object_prep(q_ptr, lookup_kind(TV_HAFTED, SV_GROND));
1101 /* Mega-Hack -- Mark this item as "Grond" */
1102 q_ptr->name1 = ART_GROND;
1104 /* Mega-Hack -- Actually create "Grond" */
1105 apply_magic(q_ptr, -1, TRUE, TRUE, TRUE, FALSE);
1107 /* Drop it in the dungeon */
1108 (void)drop_near(q_ptr, -1, y, x);
1110 /* Get local object */
1113 /* Mega-Hack -- Prepare to make "Morgoth" */
1114 object_prep(q_ptr, lookup_kind(TV_CROWN, SV_MORGOTH));
1116 /* Mega-Hack -- Mark this item as "Morgoth" */
1117 q_ptr->name1 = ART_CHAOS;
1119 /* Mega-Hack -- Actually create "Morgoth" */
1120 apply_magic(q_ptr, -1, TRUE, TRUE, TRUE, FALSE);
1122 /* Drop it in the dungeon */
1123 (void)drop_near(q_ptr, -1, y, x);
1130 switch (m_ptr->r_idx)
1145 case MON_UNICORN_ORD:
1148 if (p_ptr->pseikaku == SEIKAKU_NAMAKE)
1152 switch (randint0(3))
1155 a_idx = ART_NAMAKE_HAMMER;
1158 a_idx = ART_NAMAKE_BOW;
1161 a_idx = ART_NAMAKE_ARMOR;
1165 while (a_info[a_idx].cur_num);
1176 case MON_STORMBRINGER:
1177 a_idx = ART_STORMBRINGER;
1182 a_idx = ART_CRIMSON;
1192 a_idx = ART_KUSANAGI;
1222 a_idx = ART_WEREWINDLE;
1230 a_idx = ART_GRAYSWANDIR;
1241 a_idx = ART_TWILIGHT;
1246 a_idx = ART_ELENDIL;
1261 a_idx = ART_DESTINY;
1266 a_idx = ART_ZANTETSU;
1281 a_idx = ART_WINBLOWS;
1285 case MON_LUNGORTHIN:
1290 case MON_JACK_SHADOWS:
1296 a_idx = ART_STONEMASK;
1301 a_idx = ART_SOULCRUSH;
1306 a_idx = ART_EXCALIBUR_J;
1311 a_idx = ART_SHUTEN_DOJI;
1316 a_idx = ART_GOTHMOG;
1326 if ((a_idx > 0) && ((randint0(100) < chance) || (wizard)))
1328 if (a_info[a_idx].cur_num == 0)
1330 /* Create the artifact */
1331 create_named_art(a_idx, y, x);
1333 a_info[a_idx].cur_num = 1;
1338 if ((r_ptr->flags7 & RF7_GUARDIAN) && !p_ptr->inside_battle && (d_info[dungeon_type].final_guardian == m_ptr->r_idx))
1340 int k_idx = 198; /* Acquirement */;
1342 if (d_info[dungeon_type].final_object)
1343 k_idx = d_info[dungeon_type].final_object;
1345 if (d_info[dungeon_type].final_artifact)
1347 int a_idx = d_info[dungeon_type].final_artifact;
1348 if (a_info[a_idx].cur_num == 0)
1350 /* Create the artifact */
1351 create_named_art(a_idx, y, x);
1353 a_info[a_idx].cur_num = 1;
1360 /* Get local object */
1363 /* Prepare to make a reward */
1364 object_prep(q_ptr, k_idx);
1366 apply_magic(q_ptr, object_level, FALSE, TRUE, FALSE, FALSE);
1368 /* Drop it in the dungeon */
1369 (void)drop_near(q_ptr, -1, y, x);
1372 msg_format("¤¢¤Ê¤¿¤Ï%s¤òÀ©ÇƤ·¤¿¡ª",d_name+d_info[dungeon_type].name);
1374 msg_format("You have conquered %s!",d_name+d_info[dungeon_type].name);
1378 /* Determine how much we can drop */
1379 if ((r_ptr->flags1 & RF1_DROP_60) && (randint0(100) < 60)) number++;
1380 if ((r_ptr->flags1 & RF1_DROP_90) && (randint0(100) < 90)) number++;
1381 if (r_ptr->flags1 & RF1_DROP_1D2) number += damroll(1, 2);
1382 if (r_ptr->flags1 & RF1_DROP_2D2) number += damroll(2, 2);
1383 if (r_ptr->flags1 & RF1_DROP_3D2) number += damroll(3, 2);
1384 if (r_ptr->flags1 & RF1_DROP_4D2) number += damroll(4, 2);
1386 if (cloned && !(r_ptr->flags1 & RF1_UNIQUE))
1387 number = 0; /* Clones drop no stuff unless Cloning Pits */
1389 if (is_pet(m_ptr) || p_ptr->inside_battle || p_ptr->inside_arena)
1390 number = 0; /* Pets drop no stuff */
1391 if (!drop_item && (r_ptr->d_char != '$')) number = 0;
1393 /* Hack -- handle creeping coins */
1394 coin_type = force_coin;
1396 /* Average dungeon and monster levels */
1397 object_level = (dun_level + r_ptr->level) / 2;
1399 /* Drop some objects */
1400 for (j = 0; j < number; j++)
1402 /* Get local object */
1405 /* Wipe the object */
1409 if (do_gold && (!do_item || (randint0(100) < 50)))
1411 /* Make some gold */
1412 if (!make_gold(q_ptr)) continue;
1421 /* Make an object */
1422 if (!make_object(q_ptr, good, great)) continue;
1428 /* Drop it in the dungeon */
1429 (void)drop_near(q_ptr, -1, y, x);
1432 /* Reset the object level */
1433 object_level = base_level;
1435 /* Reset "coin" type */
1439 /* Take note of any dropped treasure */
1440 if (visible && (dump_item || dump_gold))
1442 /* Take notes on treasure */
1443 lore_treasure(m_idx, dump_item, dump_gold);
1446 /* Only process "Quest Monsters" */
1447 if (!(r_ptr->flags1 & RF1_QUESTOR)) return;
1448 if (p_ptr->inside_battle) return;
1451 if (m_ptr->r_idx == MON_SERPENT)
1454 total_winner = TRUE;
1456 /* Redraw the "title" */
1457 p_ptr->redraw |= (PR_TITLE);
1460 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "¸«»ö¤ËÊѶòÈÚÅܤξ¡Íø¼Ô¤È¤Ê¤Ã¤¿¡ª");
1462 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "become *WINNER* of Hengband finly!");
1465 if (p_ptr->pclass == CLASS_CHAOS_WARRIOR)
1468 msg_format("%s¤«¤é¤ÎÀ¼¤¬¶Á¤¤¤¿¡£", chaos_patrons[p_ptr->chaos_patron]);
1469 msg_print("¡Ø¤è¤¯¤ä¤Ã¤¿¡¢ÄêÌ¿¤Î¼Ô¤è¡ª¡Ù");
1471 msg_format("The voice of %s booms out:", chaos_patrons[p_ptr->chaos_patron]);
1472 msg_print("'Thou art donst well, mortal!'");
1476 /* Congratulations */
1478 msg_print("*** ¤ª¤á¤Ç¤È¤¦ ***");
1480 msg_print("*** CONGRATULATIONS ***");
1484 msg_print("¤¢¤Ê¤¿¤Ï¥²¡¼¥à¤ò¥³¥ó¥×¥ê¡¼¥È¤·¤Þ¤·¤¿¡£");
1486 msg_print("You have won the game!");
1490 msg_print("½àÈ÷¤¬À°¤Ã¤¿¤é°úÂà(¼«»¦¥³¥Þ¥ó¥É)¤·¤Æ¤â·ë¹½¤Ç¤¹¡£");
1492 msg_print("You may retire (commit suicide) when you are ready.");
1499 * Modify the physical damage done to the monster.
1500 * (for example when it's invulnerable or shielded)
1502 * ToDo: Accept a damage-type to calculate the modified damage from
1503 * things like fire, frost, lightning, poison, ... attacks.
1505 * "type" is not yet used and should be 0.
1507 int mon_damage_mod(monster_type *m_ptr, int dam, bool is_psy_spear)
1509 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1511 if ((r_ptr->flags3 & RF3_RES_ALL) && dam > 0)
1514 if((dam == 0) && one_in_(3)) dam = 1;
1517 if (m_ptr->invulner)
1521 if(!p_ptr->blind && m_ptr->ml)
1524 msg_print("¥Ð¥ê¥¢¤òÀÚ¤êÎö¤¤¤¿¡ª");
1526 msg_print("The barrier is penetrated!");
1530 else if (!one_in_(PENETRATE_INVULNERABILITY))
1538 static void get_exp_from_mon(int dam, monster_type *m_ptr)
1540 s32b div, new_exp, new_exp_frac;
1541 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1542 int monnum_penarty = 0;
1544 if (!m_ptr->r_idx) return;
1545 if (is_pet(m_ptr) || p_ptr->inside_battle) return;
1549 u32b m_exp_h, m_exp_l;
1551 if ((r_ptr->flags2 & RF2_MULTIPLY) || (m_ptr->r_idx == MON_DAWN))
1553 monnum_penarty = r_ptr->r_pkills / 400;
1554 if (monnum_penarty > 8) monnum_penarty = 8;
1556 if (r_ptr->flags1 & RF1_UNIQUE)
1558 m_exp = (long)r_ptr->mexp * r_ptr->level;
1559 div = (p_ptr->max_plv+2);
1563 m_exp = (long)r_ptr->mexp * r_ptr->level * extract_energy[m_ptr->mspeed];
1564 div = (p_ptr->max_plv+2) * extract_energy[r_ptr->speed];
1566 m_exp_h = m_exp/0x10000L;
1567 m_exp_l = m_exp%0x10000L;
1570 m_exp_h += m_exp_l / 0x10000L;
1571 m_exp_l %= 0x10000L;
1573 /* real monster maxhp have effect on EXP */
1574 if(!(r_ptr->flags1 & RF1_FORCE_MAXHP))
1576 u32b maxhp = m_ptr->max_maxhp*2;
1579 m_exp_h += m_exp_l / 0x10000L;
1580 m_exp_l %= 0x10000L;
1582 div *= r_ptr->hdice * (r_ptr->hside + 1);
1584 if (!dun_level && (!(r_ptr->flags8 & RF8_WILD_ONLY) || !(r_ptr->flags1 & RF1_UNIQUE))) div *= 5;
1585 div_h = div/0x10000L;
1586 div_l = div%0x10000L;
1587 div_h *= (m_ptr->max_maxhp*2);
1588 div_l *= (m_ptr->max_maxhp*2);
1589 div_h += div_l / 0x10000L;
1592 while (monnum_penarty)
1596 div_h += div_l / 0x10000L;
1601 m_exp_l = (0x7fffffff & (m_exp_h << 16)) | m_exp_l;
1602 m_exp_h = m_exp_h >> 15;
1603 div_l = (0x7fffffff & (div_h << 16)) | div_l;
1604 div_h = div_h >> 15;
1606 #define M_INT_GREATER63(h1,l1,h2,l2) ( (h1>h2)||( (h1==h2)&&(l1>=l2)))
1607 #define M_INT_SUB63(h1,l1, h2,l2) {h1-=h2;if(l1<l2){l1+=0x80000000;h1--;}l1-=l2;}
1608 #define M_INT_LSHIFT63(h1,l1) {h1=(h1<<1)|(l1>>30);l1=(l1<<1)&0x7fffffff;}
1609 #define M_INT_RSHIFT63(h1,l1) {l1=(l1>>1)|(h1<<30);h1>>=1;}
1610 #define M_INT_DIV63(h1,l1,h2,l2,result) \
1614 while( M_INT_GREATER63(h1,l1, h2, l2) ){M_INT_LSHIFT63(h2, l2); bit<<=1;} \
1615 for(bit>>=1; bit>=1; bit>>=1){ \
1616 M_INT_RSHIFT63(h2, l2); \
1617 if(M_INT_GREATER63(h1, l1, h2, l2)) \
1618 {result|=bit;M_INT_SUB63(h1, l1, h2, l2);} \
1622 /* Give some experience for the kill */
1623 M_INT_DIV63(m_exp_h, m_exp_l, div_h, div_l, new_exp);
1625 /* Handle fractional experience */
1626 /* multiply 0x10000L to remainder */
1627 m_exp_h = (m_exp_h<<16) | (m_exp_l>>15);
1629 M_INT_DIV63(m_exp_h, m_exp_l, div_h, div_l, new_exp_frac);
1630 new_exp_frac += p_ptr->exp_frac;
1631 /* Keep track of experience */
1632 if (new_exp_frac >= 0x10000L)
1635 p_ptr->exp_frac = (u16b)(new_exp_frac - 0x10000L);
1639 p_ptr->exp_frac = (u16b)new_exp_frac;
1642 /* Gain experience */
1650 * Decreases monsters hit points, handling monster death.
1652 * We return TRUE if the monster has been killed (and deleted).
1654 * We announce monster death (using an optional "death message"
1655 * if given, and a otherwise a generic killed/destroyed message).
1657 * Only "physical attacks" can induce the "You have slain" message.
1658 * Missile and Spell attacks will induce the "dies" message, or
1659 * various "specialized" messages. Note that "You have destroyed"
1660 * and "is destroyed" are synonyms for "You have slain" and "dies".
1662 * Hack -- unseen monsters yield "You have killed it." message.
1664 * Added fear (DGK) and check whether to print fear messages -CWS
1666 * Made name, sex, and capitalization generic -BEN-
1668 * As always, the "ghost" processing is a total hack.
1670 * Hack -- we "delay" fear messages by passing around a "fear" flag.
1672 * XXX XXX XXX Consider decreasing monster experience over time, say,
1673 * by using "(m_exp * m_lev * (m_lev)) / (p_lev * (m_lev + n_killed))"
1674 * instead of simply "(m_exp * m_lev) / (p_lev)", to make the first
1675 * monster worth more than subsequent monsters. This would also need
1676 * to induce changes in the monster recall code.
1678 bool mon_take_hit(int m_idx, int dam, bool *fear, cptr note)
1680 monster_type *m_ptr = &m_list[m_idx];
1681 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1683 monster_type exp_mon;
1685 /* Innocent until proven otherwise */
1686 bool innocent = TRUE, thief = FALSE;
1690 COPY(&exp_mon, m_ptr, monster_type);
1691 if (!(r_ptr->flags7 & RF7_KILL_EXP))
1693 expdam = (m_ptr->hp > dam) ? dam : m_ptr->hp;
1694 if (r_ptr->flags6 & RF6_HEAL) expdam = (expdam+1) * 2 / 3;
1696 get_exp_from_mon(expdam, &exp_mon);
1699 /* Redraw (later) if needed */
1700 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1701 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
1706 /* Hack - Cancel any special player stealth magics. -LM- */
1707 if (p_ptr->special_defense & NINJA_S_STEALTH)
1709 set_superstealth(FALSE);
1715 /* It is dead now */
1720 if (r_info[m_ptr->r_idx].flags7 & RF7_TANUKI)
1722 r_ptr = &r_info[m_ptr->r_idx];
1723 m_ptr->ap_r_idx = m_ptr->r_idx;
1724 if (r_ptr->r_sights < MAX_SHORT) r_ptr->r_sights++;
1727 /* Extract monster name */
1728 monster_desc(m_name, m_ptr, 0x100);
1730 /* Don't kill Amberites */
1731 if ((r_ptr->flags3 & RF3_AMBERITE) && one_in_(2))
1733 int curses = 1 + randint1(3);
1734 bool stop_ty = FALSE;
1738 msg_format("%^s¤Ï¶²¤í¤·¤¤·ì¤Î¼ö¤¤¤ò¤¢¤Ê¤¿¤Ë¤«¤±¤¿¡ª", m_name);
1740 msg_format("%^s puts a terrible blood curse on you!", m_name);
1743 curse_equipment(100, 50);
1747 stop_ty = activate_ty_curse(stop_ty, &count);
1752 if (r_ptr->flags2 & RF2_CAN_SPEAK)
1754 char line_got[1024];
1756 /* Dump a message */
1758 if (!get_rnd_line("mondeath_j.txt", m_ptr->r_idx, line_got))
1760 if (!get_rnd_line("mondeath.txt", m_ptr->r_idx, line_got))
1763 msg_format("%^s %s", m_name, line_got);
1766 if (m_ptr->r_idx == MON_SERPENT)
1768 /* Make screen dump */
1769 screen_dump = make_screen_dump();
1774 if (!(d_info[dungeon_type].flags1 & DF1_BEGINNER))
1776 if (!dun_level && !ambush_flag && !p_ptr->inside_arena)
1778 chg_virtue(V_VALOUR, -1);
1780 else if (r_ptr->level > dun_level)
1782 if (randint1(10) <= (r_ptr->level - dun_level))
1783 chg_virtue(V_VALOUR, 1);
1785 if (r_ptr->level > 60)
1787 chg_virtue(V_VALOUR, 1);
1789 if (r_ptr->level >= 2 * (p_ptr->lev+1))
1790 chg_virtue(V_VALOUR, 2);
1793 if ((r_ptr->flags1 & RF1_UNIQUE) && ((r_ptr->flags3 & RF3_EVIL) ||
1794 (r_ptr->flags3 & RF3_GOOD)))
1796 chg_virtue(V_HARMONY, 2);
1798 if ((r_ptr->flags1 & RF1_UNIQUE) && (r_ptr->flags3 & RF3_GOOD))
1800 chg_virtue(V_UNLIFE, 2);
1801 chg_virtue(V_VITALITY, -2);
1804 if ((r_ptr->flags1 & RF1_UNIQUE) && one_in_(3))
1805 chg_virtue(V_INDIVIDUALISM, -1);
1807 if (m_ptr->r_idx == MON_BEGGAR || m_ptr->r_idx == MON_LEPER)
1809 chg_virtue(V_COMPASSION, -1);
1812 if ((r_ptr->flags3 & RF3_GOOD) &&
1813 ((r_ptr->level) / 10 + (3 * dun_level) >= randint1(100)))
1815 chg_virtue(V_UNLIFE, 1);
1817 if (r_ptr->d_char == 'A')
1819 if (r_ptr->flags1 & RF1_UNIQUE)
1820 chg_virtue(V_FAITH, -2);
1821 else if ((r_ptr->level) / 10 + (3 * dun_level) >= randint1(100))
1823 if (r_ptr->flags3 & RF3_GOOD) chg_virtue(V_FAITH, -1);
1824 else chg_virtue(V_FAITH, 1);
1827 else if (r_ptr->flags3 & RF3_DEMON)
1829 if (r_ptr->flags1 & RF1_UNIQUE)
1830 chg_virtue(V_FAITH, 2);
1831 else if ((r_ptr->level) / 10 + (3 * dun_level) >= randint1(100))
1832 chg_virtue(V_FAITH, 1);
1835 if ((r_ptr->flags3 & RF3_UNDEAD) && (r_ptr->flags1 & RF1_UNIQUE))
1836 chg_virtue(V_VITALITY, 2);
1838 if (r_ptr->r_deaths)
1840 if (r_ptr->flags1 & RF1_UNIQUE)
1842 chg_virtue(V_HONOUR, 10);
1844 else if ((r_ptr->level) / 10 + (2 * dun_level) >= randint1(100))
1846 chg_virtue(V_HONOUR, 1);
1849 if ((r_ptr->flags2 & RF2_MULTIPLY) && (r_ptr->r_pkills > 1000) && one_in_(10))
1851 chg_virtue(V_VALOUR, -1);
1854 for (i = 0; i < 4; i++)
1856 if(r_ptr->blow[i].d_dice != 0) innocent = FALSE; /* Murderer! */
1858 if ((r_ptr->blow[i].effect == RBE_EAT_ITEM)
1859 || (r_ptr->blow[i].effect == RBE_EAT_GOLD))
1861 thief = TRUE; /* Thief! */
1864 /* The new law says it is illegal to live in the dungeon */
1865 if (r_ptr->level != 0) innocent = FALSE;
1869 if (r_ptr->flags1 & RF1_UNIQUE)
1870 chg_virtue(V_JUSTICE, 3);
1871 else if (1+((r_ptr->level) / 10 + (2 * dun_level))
1874 chg_virtue(V_JUSTICE, 1);
1878 chg_virtue (V_JUSTICE, -1);
1881 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)))
1883 if (one_in_(4)) chg_virtue(V_NATURE, -1);
1886 if((r_ptr->flags1 & RF1_UNIQUE) && record_destroy_uniq)
1887 do_cmd_write_nikki(NIKKI_UNIQUE, 0, r_name + r_ptr->name);
1892 /* Death by Missile/Spell attack */
1895 msg_format("%^s%s", m_name, note);
1898 /* Death by physical attack -- invisible monster */
1899 else if (!m_ptr->ml)
1902 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
1903 msg_format("¤»¤Ã¤«¤¯¤À¤«¤é%s¤ò»¦¤·¤¿¡£", m_name);
1905 msg_format("%s¤ò»¦¤·¤¿¡£", m_name);
1907 msg_format("You have killed %s.", m_name);
1912 /* Death by Physical attack -- non-living monster */
1913 else if (!monster_living(r_ptr))
1916 bool explode = FALSE;
1918 for (i = 0; i < 4; i++)
1920 if (r_ptr->blow[i].method == RBM_EXPLODE) explode = TRUE;
1923 /* Special note at death */
1926 msg_format("%s¤ÏÇúȯ¤·¤ÆÊ´¡¹¤Ë¤Ê¤Ã¤¿¡£", m_name);
1928 msg_format("%s explodes into tiny shreds.", m_name);
1933 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
1934 msg_format("¤»¤Ã¤«¤¯¤À¤«¤é%s¤òÅݤ·¤¿¡£", m_name);
1936 msg_format("%s¤òÅݤ·¤¿¡£", m_name);
1938 msg_format("You have destroyed %s.", m_name);
1943 /* Death by Physical attack -- living monster */
1947 if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
1948 msg_format("¤»¤Ã¤«¤¯¤À¤«¤é%s¤òÁò¤êµî¤Ã¤¿¡£", m_name);
1950 msg_format("%s¤òÁò¤êµî¤Ã¤¿¡£", m_name);
1952 msg_format("You have slain %s.", m_name);
1956 if (r_ptr->flags1 & RF1_UNIQUE && !(m_ptr->smart & SM_CLONED))
1958 for (i = 0; i < MAX_KUBI; i++)
1960 if ((kubi_r_idx[i] == m_ptr->r_idx) && !(m_ptr->mflag2 & MFLAG_CHAMELEON))
1963 msg_format("%s¤Î¼ó¤Ë¤Ï¾Þ¶â¤¬¤«¤«¤Ã¤Æ¤¤¤ë¡£", m_name);
1965 msg_format("There is a price on %s's head.", m_name);
1972 if (r_ptr->flags7 & RF7_KILL_EXP)
1973 get_exp_from_mon((long)m_ptr->max_maxhp*2, &exp_mon);
1975 get_exp_from_mon(((long)m_ptr->max_maxhp+1L) * 9L / 10L, &exp_mon);
1977 /* Generate treasure */
1978 monster_death(m_idx, TRUE);
1979 if (m_ptr->mflag2 & MFLAG_CHAMELEON)
1981 if (r_ptr->flags1 & RF1_UNIQUE)
1982 r_ptr = &r_info[MON_CHAMELEON_K];
1984 r_ptr = &r_info[MON_CHAMELEON];
1985 if (r_ptr->r_sights < MAX_SHORT) r_ptr->r_sights++;
1988 /* When the player kills a Unique, it stays dead */
1989 if (r_ptr->flags1 & RF1_UNIQUE && !(m_ptr->smart & SM_CLONED))
1992 /* When the player kills a Nazgul, it stays dead */
1993 if (r_ptr->flags7 & RF7_UNIQUE_7) r_ptr->max_num--;
1995 /* Recall even invisible uniques or winners */
1996 if (m_ptr->ml || (r_ptr->flags1 & RF1_UNIQUE))
1998 /* Count kills this life */
1999 if ((m_ptr->mflag2 & MFLAG_KAGE) && (r_info[MON_KAGE].r_pkills < MAX_SHORT)) r_info[MON_KAGE].r_pkills++;
2000 else if (r_ptr->r_pkills < MAX_SHORT) r_ptr->r_pkills++;
2002 /* Count kills in all lives */
2003 if ((m_ptr->mflag2 & MFLAG_KAGE) && (r_info[MON_KAGE].r_tkills < MAX_SHORT)) r_info[MON_KAGE].r_tkills++;
2004 else if (r_ptr->r_tkills < MAX_SHORT) r_ptr->r_tkills++;
2006 /* Hack -- Auto-recall */
2007 monster_race_track(m_ptr->ap_r_idx);
2010 if ((m_ptr->r_idx == MON_BANOR) || (m_ptr->r_idx == MON_LUPART))
2012 r_info[MON_BANORLUPART].max_num = 0;
2013 r_info[MON_BANORLUPART].r_pkills++;
2014 if (r_info[MON_BANORLUPART].r_tkills < MAX_SHORT) r_info[MON_BANORLUPART].r_tkills++;
2017 if (m_ptr->r_idx == MON_BANORLUPART)
2019 r_info[MON_BANOR].max_num = 0;
2020 r_info[MON_BANOR].r_pkills++;
2021 if (r_info[MON_BANOR].r_tkills < MAX_SHORT) r_info[MON_BANOR].r_tkills++;
2022 r_info[MON_LUPART].max_num = 0;
2023 r_info[MON_LUPART].r_pkills++;
2024 if (r_info[MON_LUPART].r_tkills < MAX_SHORT) r_info[MON_LUPART].r_tkills++;
2027 /* Mega hack : replace IKETA to BIKETAL */
2028 if ((m_ptr->r_idx == MON_IKETA) &&
2029 !(p_ptr->inside_arena || p_ptr->inside_battle))
2031 int dummy_y = m_ptr->fy;
2032 int dummy_x = m_ptr->fx;
2033 bool friend = is_friendly(m_ptr);
2034 bool pet = is_pet(m_ptr);
2036 /* Delete the monster */
2037 delete_monster_idx(m_idx);
2039 if (summon_named_creature(dummy_y, dummy_x, MON_BIKETAL, FALSE, FALSE, friend, pet))
2042 msg_print("¡Ö¥Ï¥¡¥Ã¥Ï¥Ã¥Ï¥Ã¥Ï¡ª¡ª»ä¤¬¥Ð¥¤¥±¥¿¥ë¤À¡ª¡ª¡×");
2044 msg_print("Uwa-hahaha! *I* am Biketal!");
2050 /* Delete the monster */
2051 delete_monster_idx(m_idx);
2057 /* Monster is dead */
2064 /* Mega-Hack -- Pain cancels fear */
2065 if (m_ptr->monfear && (dam > 0))
2067 int tmp = randint1(dam);
2069 /* Cure a little fear */
2070 if (tmp < m_ptr->monfear)
2073 m_ptr->monfear -= tmp;
2076 /* Cure all the fear */
2087 /* Sometimes a monster gets scared by damage */
2088 if (!m_ptr->monfear && !(r_ptr->flags3 & (RF3_NO_FEAR)))
2092 /* Percentage of fully healthy */
2093 percentage = (100L * m_ptr->hp) / m_ptr->maxhp;
2096 * Run (sometimes) if at 10% or less of max hit points,
2097 * or (usually) when hit for half its current hit points
2099 if (((percentage <= 10) && (randint0(10) < percentage)) ||
2100 ((dam >= m_ptr->hp) && (randint0(100) < 80)))
2102 /* Hack -- note fear */
2105 /* XXX XXX XXX Hack -- Add some timed fear */
2106 m_ptr->monfear = (randint1(10) +
2107 (((dam >= m_ptr->hp) && (percentage > 7)) ?
2108 20 : ((11 - percentage) * 5)));
2115 if (p_ptr->riding && (p_ptr->riding == m_idx) && (dam > 0))
2119 /* Extract monster name */
2120 monster_desc(m_name, m_ptr, 0);
2122 if (m_ptr->hp > m_ptr->maxhp/3) dam = (dam + 1) / 2;
2123 if (rakuba((dam > 200) ? 200 : dam, FALSE))
2126 msg_format("%^s¤Ë¿¶¤êÍî¤È¤µ¤ì¤¿¡ª", m_name);
2128 msg_format("%^s has thrown you off!", m_name);
2140 * Get term size and calculate screen size
2142 void get_screen_size(int *wid_p, int *hgt_p)
2144 Term_get_size(wid_p, hgt_p);
2145 *hgt_p -= ROW_MAP + 2;
2146 *wid_p -= COL_MAP + 2;
2147 if (use_bigtile) *wid_p /= 2;
2152 * Calculates current boundaries
2153 * Called below and from "do_cmd_locate()".
2155 void panel_bounds_center(void)
2160 get_screen_size(&wid, &hgt);
2162 panel_row_max = panel_row_min + hgt - 1;
2163 panel_row_prt = panel_row_min - 1;
2164 panel_col_max = panel_col_min + wid - 1;
2165 panel_col_prt = panel_col_min - 13;
2170 * Map resizing whenever the main term changes size
2172 void resize_map(void)
2174 /* Only if the dungeon exists */
2175 if (!character_dungeon) return;
2177 /* Mega-Hack -- no panel yet */
2181 /* Reset the panels */
2182 panel_row_min = cur_hgt;
2183 panel_col_min = cur_wid;
2188 p_ptr->update |= (PU_TORCH | PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
2190 /* Forget lite/view */
2191 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
2193 /* Update lite/view */
2194 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
2196 /* Update monsters */
2197 p_ptr->update |= (PU_MONSTERS);
2199 /* Redraw everything */
2200 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
2202 /* Hack -- update */
2213 * Redraw a term when it is resized
2215 void redraw_window(void)
2217 /* Only if the dungeon exists */
2218 if (!character_dungeon) return;
2220 /* Hack - Activate term zero for the redraw */
2221 Term_activate(&term_screen[0]);
2223 /* Hack -- react to changes */
2224 Term_xtra(TERM_XTRA_REACT, 0);
2227 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
2230 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
2232 /* Hack -- update */
2244 * Handle a request to change the current panel
2246 * Return TRUE if the panel was changed.
2248 * Also used in do_cmd_locate
2250 bool change_panel(int dy, int dx)
2256 get_screen_size(&wid, &hgt);
2258 /* Apply the motion */
2259 y = panel_row_min + dy * hgt / 2;
2260 x = panel_col_min + dx * wid / 2;
2262 /* Verify the row */
2263 if (y > cur_hgt - hgt) y = cur_hgt - hgt;
2266 /* Verify the col */
2267 if (x > cur_wid - wid) x = cur_wid - wid;
2270 /* Handle "changes" */
2271 if ((y != panel_row_min) || (x != panel_col_min))
2273 /* Save the new panel info */
2277 /* Recalculate the boundaries */
2278 panel_bounds_center();
2281 p_ptr->update |= (PU_MONSTERS);
2284 p_ptr->redraw |= (PR_MAP);
2299 * Given an row (y) and col (x), this routine detects when a move
2300 * off the screen has occurred and figures new borders. -RAK-
2302 * "Update" forces a "full update" to take place.
2304 * The map is reprinted if necessary, and "TRUE" is returned.
2306 void verify_panel(void)
2318 get_screen_size(&wid, &hgt);
2320 max_prow_min = cur_hgt - hgt;
2321 max_pcol_min = cur_wid - wid;
2323 /* Bounds checking */
2324 if (max_prow_min < 0) max_prow_min = 0;
2325 if (max_pcol_min < 0) max_pcol_min = 0;
2327 /* Center on player */
2328 if (center_player && (center_running || !running))
2330 /* Center vertically */
2331 prow_min = y - hgt / 2;
2332 if (prow_min < 0) prow_min = 0;
2333 else if (prow_min > max_prow_min) prow_min = max_prow_min;
2335 /* Center horizontally */
2336 pcol_min = x - wid / 2;
2337 if (pcol_min < 0) pcol_min = 0;
2338 else if (pcol_min > max_pcol_min) pcol_min = max_pcol_min;
2342 prow_min = panel_row_min;
2343 pcol_min = panel_col_min;
2345 /* Scroll screen when 2 grids from top/bottom edge */
2346 if (y > panel_row_max - 2)
2348 while (y > prow_min + hgt-1 - 2)
2350 prow_min += (hgt / 2);
2354 if (y < panel_row_min + 2)
2356 while (y < prow_min + 2)
2358 prow_min -= (hgt / 2);
2362 if (prow_min > max_prow_min) prow_min = max_prow_min;
2363 if (prow_min < 0) prow_min = 0;
2365 /* Scroll screen when 4 grids from left/right edge */
2366 if (x > panel_col_max - 4)
2368 while (x > pcol_min + wid-1 - 4)
2370 pcol_min += (wid / 2);
2374 if (x < panel_col_min + 4)
2376 while (x < pcol_min + 4)
2378 pcol_min -= (wid / 2);
2382 if (pcol_min > max_pcol_min) pcol_min = max_pcol_min;
2383 if (pcol_min < 0) pcol_min = 0;
2386 /* Check for "no change" */
2387 if ((prow_min == panel_row_min) && (pcol_min == panel_col_min)) return;
2389 /* Save the new panel info */
2390 panel_row_min = prow_min;
2391 panel_col_min = pcol_min;
2393 /* Hack -- optional disturb on "panel change" */
2394 if (disturb_panel && !center_player) disturb(0, 0);
2396 /* Recalculate the boundaries */
2397 panel_bounds_center();
2400 p_ptr->update |= (PU_MONSTERS);
2403 p_ptr->redraw |= (PR_MAP);
2406 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
2411 * Monster health description
2413 cptr look_mon_desc(int m_idx)
2415 monster_type *m_ptr = &m_list[m_idx];
2416 monster_race *r_ptr = &r_info[m_ptr->r_idx];
2421 /* Determine if the monster is "living" */
2422 living = monster_living(r_ptr);
2425 /* Healthy monsters */
2426 if (m_ptr->hp >= m_ptr->maxhp)
2430 return (living ? "̵½ý" : "̵¥À¥á¡¼¥¸");
2432 return (living ? "unhurt" : "undamaged");
2438 /* Calculate a health "percentage" */
2439 perc = 100L * m_ptr->hp / m_ptr->maxhp;
2444 return (living ? "·Ú½ý" : "¾®¥À¥á¡¼¥¸");
2446 return (living ? "somewhat wounded" : "somewhat damaged");
2454 return (living ? "Éé½ý" : "Ãæ¥À¥á¡¼¥¸");
2456 return (living ? "wounded" : "damaged");
2464 return (living ? "½Å½ý" : "Âç¥À¥á¡¼¥¸");
2466 return (living ? "badly wounded" : "badly damaged");
2472 return (living ? "Ⱦ»àȾÀ¸" : "Åݤ줫¤±");
2474 return (living ? "almost dead" : "almost destroyed");
2482 * Angband sorting algorithm -- quick sort in place
2484 * Note that the details of the data we are sorting is hidden,
2485 * and we rely on the "ang_sort_comp()" and "ang_sort_swap()"
2486 * function hooks to interact with the data, which is given as
2487 * two pointers, and which may have any user-defined form.
2489 void ang_sort_aux(vptr u, vptr v, int p, int q)
2507 while (!(*ang_sort_comp)(u, v, b, z)) b--;
2510 while (!(*ang_sort_comp)(u, v, z, a)) a++;
2512 /* Done partition */
2516 (*ang_sort_swap)(u, v, a, b);
2522 /* Recurse left side */
2523 ang_sort_aux(u, v, p, b);
2525 /* Recurse right side */
2526 ang_sort_aux(u, v, b+1, q);
2531 * Angband sorting algorithm -- quick sort in place
2533 * Note that the details of the data we are sorting is hidden,
2534 * and we rely on the "ang_sort_comp()" and "ang_sort_swap()"
2535 * function hooks to interact with the data, which is given as
2536 * two pointers, and which may have any user-defined form.
2538 void ang_sort(vptr u, vptr v, int n)
2540 /* Sort the array */
2541 ang_sort_aux(u, v, 0, n-1);
2546 /*** Targeting Code ***/
2550 * Determine is a monster makes a reasonable target
2552 * The concept of "targeting" was stolen from "Morgul" (?)
2554 * The player can target any location, or any "target-able" monster.
2556 * Currently, a monster is "target_able" if it is visible, and if
2557 * the player can hit it with a projection, and the player is not
2558 * hallucinating. This allows use of "use closest target" macros.
2560 * Future versions may restrict the ability to target "trappers"
2561 * and "mimics", but the semantics is a little bit weird.
2563 bool target_able(int m_idx)
2565 monster_type *m_ptr = &m_list[m_idx];
2567 /* Monster must be alive */
2568 if (!m_ptr->r_idx) return (FALSE);
2570 /* Hack -- no targeting hallucinations */
2571 if (p_ptr->image) return (FALSE);
2573 /* Monster must be visible */
2574 if (!m_ptr->ml) return (FALSE);
2576 if (p_ptr->riding && (p_ptr->riding == m_idx)) return (TRUE);
2578 /* Monster must be projectable */
2579 if (!projectable(py, px, m_ptr->fy, m_ptr->fx)) return (FALSE);
2581 /* XXX XXX XXX Hack -- Never target trappers */
2582 /* if (CLEAR_ATTR && (CLEAR_CHAR)) return (FALSE); */
2592 * Update (if necessary) and verify (if possible) the target.
2594 * We return TRUE if the target is "okay" and FALSE otherwise.
2596 bool target_okay(void)
2598 /* Accept stationary targets */
2599 if (target_who < 0) return (TRUE);
2601 /* Check moving targets */
2604 /* Accept reasonable targets */
2605 if (target_able(target_who))
2607 monster_type *m_ptr = &m_list[target_who];
2609 /* Acquire monster location */
2610 target_row = m_ptr->fy;
2611 target_col = m_ptr->fx;
2618 /* Assume no target */
2625 * Sorting hook -- comp function -- by "distance to player"
2627 * We use "u" and "v" to point to arrays of "x" and "y" positions,
2628 * and sort the arrays by double-distance to the player.
2630 static bool ang_sort_comp_distance(vptr u, vptr v, int a, int b)
2632 byte *x = (byte*)(u);
2633 byte *y = (byte*)(v);
2637 /* Absolute distance components */
2638 kx = x[a]; kx -= px; kx = ABS(kx);
2639 ky = y[a]; ky -= py; ky = ABS(ky);
2641 /* Approximate Double Distance to the first point */
2642 da = ((kx > ky) ? (kx + kx + ky) : (ky + ky + kx));
2644 /* Absolute distance components */
2645 kx = x[b]; kx -= px; kx = ABS(kx);
2646 ky = y[b]; ky -= py; ky = ABS(ky);
2648 /* Approximate Double Distance to the first point */
2649 db = ((kx > ky) ? (kx + kx + ky) : (ky + ky + kx));
2651 /* Compare the distances */
2657 * Sorting hook -- swap function -- by "distance to player"
2659 * We use "u" and "v" to point to arrays of "x" and "y" positions,
2660 * and sort the arrays by distance to the player.
2662 static void ang_sort_swap_distance(vptr u, vptr v, int a, int b)
2664 byte *x = (byte*)(u);
2665 byte *y = (byte*)(v);
2683 * Hack -- help "select" a location (see below)
2685 static s16b target_pick(int y1, int x1, int dy, int dx)
2689 int x2, y2, x3, y3, x4, y4;
2691 int b_i = -1, b_v = 9999;
2694 /* Scan the locations */
2695 for (i = 0; i < temp_n; i++)
2701 /* Directed distance */
2705 /* Verify quadrant */
2706 if (dx && (x3 * dx <= 0)) continue;
2707 if (dy && (y3 * dy <= 0)) continue;
2709 /* Absolute distance */
2713 /* Verify quadrant */
2714 if (dy && !dx && (x4 > y4)) continue;
2715 if (dx && !dy && (y4 > x4)) continue;
2717 /* Approximate Double Distance */
2718 v = ((x4 > y4) ? (x4 + x4 + y4) : (y4 + y4 + x4));
2720 /* XXX XXX XXX Penalize location */
2723 if ((b_i >= 0) && (v >= b_v)) continue;
2735 * Hack -- determine if a given location is "interesting"
2737 static bool target_set_accept(int y, int x)
2741 s16b this_o_idx, next_o_idx = 0;
2744 if (!(in_bounds(y, x))) return (FALSE);
2746 /* Player grid is always interesting */
2747 if ((y == py) && (x == px)) return (TRUE);
2750 /* Handle hallucination */
2751 if (p_ptr->image) return (FALSE);
2754 /* Examine the grid */
2755 c_ptr = &cave[y][x];
2757 /* Visible monsters */
2760 monster_type *m_ptr = &m_list[c_ptr->m_idx];
2762 /* Visible monsters */
2763 if (m_ptr->ml) return (TRUE);
2766 /* Scan all objects in the grid */
2767 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
2771 /* Acquire object */
2772 o_ptr = &o_list[this_o_idx];
2774 /* Acquire next object */
2775 next_o_idx = o_ptr->next_o_idx;
2777 /* Memorized object */
2778 if (o_ptr->marked) return (TRUE);
2781 /* Interesting memorized features */
2782 if (c_ptr->info & (CAVE_MARK))
2785 if (c_ptr->feat == FEAT_GLYPH) return (TRUE);
2786 if (c_ptr->feat == FEAT_MINOR_GLYPH) return (TRUE);
2787 if (c_ptr->feat == FEAT_MIRROR) return (TRUE);
2789 /* Notice the Pattern */
2790 if ((c_ptr->feat <= FEAT_PATTERN_XTRA2) &&
2791 (c_ptr->feat >= FEAT_PATTERN_START))
2795 if (c_ptr->feat == FEAT_OPEN) return (TRUE);
2796 if (c_ptr->feat == FEAT_BROKEN) return (TRUE);
2799 if (c_ptr->feat == FEAT_LESS) return (TRUE);
2800 if (c_ptr->feat == FEAT_MORE) return (TRUE);
2801 if (c_ptr->feat == FEAT_LESS_LESS) return (TRUE);
2802 if (c_ptr->feat == FEAT_MORE_MORE) return (TRUE);
2805 if ((c_ptr->feat >= FEAT_SHOP_HEAD) &&
2806 (c_ptr->feat <= FEAT_SHOP_TAIL)) return (TRUE);
2808 if (c_ptr->feat == FEAT_MUSEUM) return (TRUE);
2810 /* Notice buildings -KMW- */
2811 if ((c_ptr->feat >= FEAT_BLDG_HEAD) &&
2812 (c_ptr->feat <= FEAT_BLDG_TAIL)) return (TRUE);
2815 if (is_trap(c_ptr->feat)) return (TRUE);
2818 if ((c_ptr->feat >= FEAT_DOOR_HEAD) &&
2819 (c_ptr->feat <= FEAT_DOOR_TAIL)) return (TRUE);
2822 /* I think FEAT_RUBBLEs should not be "interesting" */
2824 if (c_ptr->feat == FEAT_RUBBLE) return (TRUE);
2826 /* Notice veins with treasure */
2827 if (c_ptr->feat == FEAT_MAGMA_K) return (TRUE);
2828 if (c_ptr->feat == FEAT_QUARTZ_K) return (TRUE);
2830 /* Notice quest features */
2831 if (c_ptr->feat == FEAT_QUEST_ENTER) return (TRUE);
2832 if (c_ptr->feat == FEAT_QUEST_EXIT) return (TRUE);
2833 if (c_ptr->feat == FEAT_QUEST_DOWN) return (TRUE);
2834 if (c_ptr->feat == FEAT_QUEST_UP) return (TRUE);
2835 if (c_ptr->feat == FEAT_TOWN) return (TRUE);
2836 if (c_ptr->feat == FEAT_ENTRANCE) return (TRUE);
2845 * Prepare the "temp" array for "target_set"
2847 * Return the number of target_able monsters in the set.
2849 static void target_set_prepare(int mode)
2853 /* Reset "temp" array */
2856 /* Scan the current panel */
2857 for (y = panel_row_min; y <= panel_row_max; y++)
2859 for (x = panel_col_min; x <= panel_col_max; x++)
2863 /* Require line of sight, unless "look" is "expanded" */
2864 if (!expand_look && !player_has_los_bold(y, x)) continue;
2866 /* Require "interesting" contents */
2867 if (!target_set_accept(y, x)) continue;
2869 c_ptr = &cave[y][x];
2871 /* Require target_able monsters for "TARGET_KILL" */
2872 if ((mode & (TARGET_KILL)) && !target_able(c_ptr->m_idx)) continue;
2874 if ((mode & (TARGET_KILL)) && !target_pet && is_pet(&m_list[c_ptr->m_idx])) continue;
2876 /* Save the location */
2883 /* Set the sort hooks */
2884 ang_sort_comp = ang_sort_comp_distance;
2885 ang_sort_swap = ang_sort_swap_distance;
2887 /* Sort the positions */
2888 ang_sort(temp_x, temp_y, temp_n);
2890 if (p_ptr->riding && target_pet && (temp_n > 1) && (mode & (TARGET_KILL)))
2895 temp_y[0] = temp_y[1];
2898 temp_x[0] = temp_x[1];
2905 * Examine a grid, return a keypress.
2907 * The "mode" argument contains the "TARGET_LOOK" bit flag, which
2908 * indicates that the "space" key should scan through the contents
2909 * of the grid, instead of simply returning immediately. This lets
2910 * the "look" command get complete information, without making the
2911 * "target" command annoying.
2913 * The "info" argument contains the "commands" which should be shown
2914 * inside the "[xxx]" text. This string must never be empty, or grids
2915 * containing monsters will be displayed with an extra comma.
2917 * Note that if a monster is in the grid, we update both the monster
2918 * recall info and the health bar info to track that monster.
2920 * Eventually, we may allow multiple objects per grid, or objects
2921 * and terrain features in the same grid. XXX XXX XXX
2923 * This function must handle blindness/hallucination.
2925 static int target_set_aux(int y, int x, int mode, cptr info)
2927 cave_type *c_ptr = &cave[y][x];
2929 s16b this_o_idx, next_o_idx = 0;
2939 char out_val[MAX_NLEN+80];
2942 /* Repeat forever */
2961 /* Hack -- under the player */
2962 if ((y == py) && (x == px))
2986 /* Hack -- hallucination */
2990 cptr name = "²¿¤«´ñ̯¤Êʪ";
2992 cptr name = "something strange";
2996 /* Display a message */
2998 sprintf(out_val, "%s%s%s%s [%s]", s1, name, s2, s3, info);
3000 sprintf(out_val, "%s%s%s%s [%s]", s1, s2, s3, name, info);
3004 move_cursor_relative(y, x);
3007 /* Stop on everything but "return" */
3008 if ((query != '\r') && (query != '\n')) break;
3010 /* Repeat forever */
3015 /* Actual monsters */
3018 monster_type *m_ptr = &m_list[c_ptr->m_idx];
3019 monster_race *r_ptr = &r_info[m_ptr->r_idx];
3024 bool recall = FALSE;
3031 /* Get the monster name ("a kobold") */
3032 monster_desc(m_name, m_ptr, 0x08);
3034 /* Hack -- track this monster race */
3035 monster_race_track(m_ptr->ap_r_idx);
3037 /* Hack -- health bar for this monster */
3038 health_track(c_ptr->m_idx);
3040 /* Hack -- handle stuff */
3052 /* Recall on screen */
3053 screen_roff(m_ptr->ap_r_idx, 0);
3055 /* Hack -- Complete the prompt (again) */
3057 Term_addstr(-1, TERM_WHITE, format(" [r»× %s]", info));
3059 Term_addstr(-1, TERM_WHITE, format(" [r,%s]", info));
3076 if (p_ptr->riding && (p_ptr->riding == c_ptr->m_idx))
3079 tekitou = "(¥Ú¥Ã¥È)";
3089 if (is_pet(m_ptr) && (p_ptr->riding != c_ptr->m_idx))
3091 attitude = " (¥Ú¥Ã¥È) ";
3093 attitude = " (pet) ";
3096 else if (is_friendly(m_ptr))
3098 attitude = " (ͧ¹¥Åª) ";
3100 attitude = " (friendly) ";
3111 /* Describe, and prompt for recall */
3113 #define M_INT_GREATER(h1,l1,h2,l2) ( (h1>h2)||( (h1==h2)&&(l1>=l2)))
3114 #define M_INT_SUB(h1,l1, h2,l2) {h1-=h2;if(l1<l2){l1+=0x10000;h1--;}l1-=l2;}
3115 #define M_INT_ADD(h1,l1, h2,l2) {h1+=h2;l1+=l2;if(l1>=0x10000L){l1&=0xFFFF;h1++;}}
3116 #define M_INT_LSHIFT(h1,l1) {h1=(h1<<1)|(l1>>15);l1=(l1<<1)&0xffff;}
3117 #define M_INT_RSHIFT(h1,l1) {l1=(l1>>1)|((h1&1)<<15);h1>>=1;}
3118 #define M_INT_MULT(h1,l1,mul,h2,l2) {l2=(l1*mul)&0xffff;h2=((l1*mul)>>16)+h1*mul;}
3122 u32b exp_mon= (r_ptr->mexp)*(r_ptr->level);
3123 u32b exp_mon_h= exp_mon / (p_ptr->max_plv+2);
3124 u32b exp_mon_l= ((exp_mon % (p_ptr->max_plv+2))*0x10000/(p_ptr->max_plv+2))&0xFFFF;
3126 u32b exp_adv_h = player_exp[p_ptr->lev -1] * p_ptr->expfact /100;
3127 u32b exp_adv_l = ((player_exp[p_ptr->lev -1]%100) * p_ptr->expfact *0x10000/100)&0xFFFF;
3129 M_INT_SUB(exp_adv_h, exp_adv_l, p_ptr->exp, p_ptr->exp_frac);
3130 if ((p_ptr->lev>=PY_MAX_LEVEL) || (p_ptr->prace == RACE_ANDROID))
3131 sprintf(acount,"[**]");
3132 else if (!r_ptr->r_tkills || (m_ptr->mflag2 & MFLAG_KAGE))
3133 sprintf(acount,"[??]");
3134 else if (M_INT_GREATER(exp_mon_h, exp_mon_l, exp_adv_h, exp_adv_l))
3135 sprintf(acount,"[001]");
3138 M_INT_MULT(exp_mon_h, exp_mon_l, 1000,tmp_h, tmp_l);
3139 if( M_INT_GREATER(exp_adv_h, exp_adv_l, tmp_h, tmp_l) )
3140 sprintf(acount,"[999]");
3144 M_INT_ADD(exp_adv_h, exp_adv_l, exp_mon_h, exp_mon_l);
3145 M_INT_SUB(exp_adv_h, exp_adv_l, 0, 1);
3146 while(M_INT_GREATER(exp_adv_h, exp_adv_l, exp_mon_h,exp_mon_l))
3148 M_INT_LSHIFT(exp_mon_h,exp_mon_l);
3151 M_INT_RSHIFT(exp_mon_h,exp_mon_l);bit>>=1;
3152 for(;bit>=1;bit>>=1)
3154 if(M_INT_GREATER(exp_adv_h,exp_adv_l,exp_mon_h,exp_mon_l))
3157 M_INT_SUB(exp_adv_h,exp_adv_l,exp_mon_h,exp_mon_l);
3159 M_INT_RSHIFT(exp_mon_h,exp_mon_l);
3161 sprintf(acount,"[%03d]",result);
3166 "%s%s%s(%s)%s%s%s%s%s[r»× %s]",
3167 acount, s1, m_name, look_mon_desc(c_ptr->m_idx), tekitou, s2, s3,
3169 "%s%s%s%s%s(%s)%s%s%s[r, %s]",
3170 acount, s1, s2, s3, m_name, look_mon_desc(c_ptr->m_idx), tekitou,
3172 (m_ptr->smart & SM_CLONED ? " (clone)": ""),
3179 move_cursor_relative(y, x);
3185 /* Normal commands */
3186 if (query != 'r') break;
3192 /* Always stop at "normal" keys */
3193 if ((query != '\r') && (query != '\n') && (query != ' ')) break;
3195 /* Sometimes stop at "space" key */
3196 if ((query == ' ') && !(mode & (TARGET_LOOK))) break;
3198 /* Change the intro */
3206 /* Hack -- take account of gender */
3208 if (r_ptr->flags1 & (RF1_FEMALE)) s1 = "Èà½÷¤Ï";
3210 if (r_ptr->flags1 & (RF1_FEMALE)) s1 = "She is ";
3214 else if (r_ptr->flags1 & (RF1_MALE)) s1 = "Èà¤Ï";
3216 else if (r_ptr->flags1 & (RF1_MALE)) s1 = "He is ";
3220 /* Use a preposition */
3229 /* Scan all objects being carried */
3230 for (this_o_idx = m_ptr->hold_o_idx; this_o_idx; this_o_idx = next_o_idx)
3232 char o_name[MAX_NLEN];
3236 /* Acquire object */
3237 o_ptr = &o_list[this_o_idx];
3239 /* Acquire next object */
3240 next_o_idx = o_ptr->next_o_idx;
3242 /* Obtain an object description */
3243 object_desc(o_name, o_ptr, TRUE, 3);
3245 /* Describe the object */
3247 sprintf(out_val, "%s%s%s%s[%s]", s1, o_name, s2, s3, info);
3249 sprintf(out_val, "%s%s%s%s [%s]", s1, s2, s3, o_name, info);
3253 move_cursor_relative(y, x);
3256 /* Always stop at "normal" keys */
3257 if ((query != '\r') && (query != '\n') && (query != ' ')) break;
3259 /* Sometimes stop at "space" key */
3260 if ((query == ' ') && !(mode & (TARGET_LOOK))) break;
3262 /* Change the intro */
3266 s2 = "also carrying ";
3272 if (this_o_idx) break;
3274 /* Use a preposition */
3286 #ifdef ALLOW_EASY_FLOOR
3288 /* Scan all objects in the grid */
3291 int floor_list[23], floor_num;
3293 if (scan_floor(floor_list, &floor_num, y, x, 0x02))
3302 char o_name[MAX_NLEN];
3306 /* Acquire object */
3307 o_ptr = &o_list[floor_list[0]];
3309 /* Describe the object */
3310 object_desc(o_name, o_ptr, TRUE, 3);
3314 sprintf(out_val, "%s%s%s%s[%s]",
3315 s1, o_name, s2, s3, info);
3317 sprintf(out_val, "%s%s%s%s [%s]",
3318 s1, s2, s3, o_name, info);
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);
3336 move_cursor_relative(y, x);
3341 /* Display list of items (query == "el", not "won") */
3342 if ((floor_num > 1) && (query == 'x'))
3348 (void)show_floor(0, y, x);
3352 prt("²¿¤«¥¡¼¤ò²¡¤¹¤È¥²¡¼¥à¤ËÌá¤ê¤Þ¤¹", 0, 0);
3354 prt("Hit any key to continue", 0, 0);
3376 #endif /* ALLOW_EASY_FLOOR */
3379 /* Scan all objects in the grid */
3380 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
3384 /* Acquire object */
3385 o_ptr = &o_list[this_o_idx];
3387 /* Acquire next object */
3388 next_o_idx = o_ptr->next_o_idx;
3393 char o_name[MAX_NLEN];
3398 /* Obtain an object description */
3399 object_desc(o_name, o_ptr, TRUE, 3);
3401 /* Describe the object */
3403 sprintf(out_val, "%s%s%s%s[%s]", s1, o_name, s2, s3, info);
3405 sprintf(out_val, "%s%s%s%s [%s]", s1, s2, s3, o_name, info);
3409 move_cursor_relative(y, x);
3412 /* Always stop at "normal" keys */
3413 if ((query != '\r') && (query != '\n') && (query != ' ')) break;
3415 /* Sometimes stop at "space" key */
3416 if ((query == ' ') && !(mode & TARGET_LOOK)) break;
3418 /* Change the intro */
3428 if (o_ptr->number != 1) s1 = "¤½¤ì¤é¤Ï";
3430 if (o_ptr->number != 1) s1 = "They are ";
3446 if (this_o_idx) break;
3450 feat = c_ptr->mimic;
3454 feat = f_info[c_ptr->feat].mimic;
3457 /* Require knowledge about grid, or ability to see grid */
3458 if (!(c_ptr->info & CAVE_MARK) && !player_can_see_bold(y, x))
3460 /* Forget feature */
3464 /* Terrain feature if needed */
3465 if (boring || (feat > FEAT_INVIS))
3469 /* Hack -- special handling for building doors */
3470 if ((feat >= FEAT_BLDG_HEAD) && (feat <= FEAT_BLDG_TAIL))
3472 name = building[feat - FEAT_BLDG_HEAD].name;
3474 else if (feat == FEAT_ENTRANCE)
3477 name = format("%s(%d³¬ÁêÅö)", d_text + d_info[c_ptr->special].text, d_info[c_ptr->special].mindepth);
3479 name = format("%s(level %d)", d_text + d_info[c_ptr->special].text, d_info[c_ptr->special].mindepth);
3482 else if (feat == FEAT_TOWN)
3484 name = town[c_ptr->special].name;
3486 else if (p_ptr->wild_mode && (feat == FEAT_FLOOR))
3496 name = f_name + f_info[feat].name;
3499 /* Hack -- handle unknown grids */
3501 if (feat == FEAT_NONE) name = "̤ÃΤÎÃÏ·Á";
3503 if (feat == FEAT_NONE) name = "unknown grid";
3508 if (*s2 && ((feat >= FEAT_MINOR_GLYPH) &&
3509 (feat <= FEAT_PATTERN_XTRA2)))
3518 else if (*s2 && ((feat >= FEAT_DOOR_HEAD) &&
3519 (feat <= FEAT_PERM_SOLID)))
3528 else if (*s2 && (feat == FEAT_TOWN))
3538 /* Hack -- special introduction for store & building doors -KMW- */
3539 if (((feat >= FEAT_SHOP_HEAD) && (feat <= FEAT_SHOP_TAIL)) ||
3540 ((feat >= FEAT_BLDG_HEAD) && (feat <= FEAT_BLDG_TAIL)) ||
3541 (feat == FEAT_MUSEUM) ||
3542 (feat == FEAT_ENTRANCE))
3551 else if ((feat == FEAT_TOWN) || (feat == FEAT_FLOOR) || (feat == FEAT_DIRT) || (feat == FEAT_FLOWER))
3559 /* Pick proper indefinite article */
3561 s3 = (is_a_vowel(name[0])) ? "an " : "a ";
3565 /* Display a message */
3568 sprintf(out_val, "%s%s%s%s[%s] %x %d %d %d %d (%d,%d)", s1, name, s2, s3, info, c_ptr->info, c_ptr->feat, c_ptr->dist, c_ptr->cost, c_ptr->when, x, y);
3570 sprintf(out_val, "%s%s%s%s [%s] %x %d %d %d %d", s1, s2, s3, name, info, c_ptr->info, c_ptr->feat, c_ptr->dist, c_ptr->cost, c_ptr->when);
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 != ' ')) break;
3587 /* Stop on everything but "return" */
3588 if ((query != '\r') && (query != '\n')) break;
3597 * Handle "target" and "look".
3599 * Note that this code can be called from "get_aim_dir()".
3601 * All locations must be on the current panel. Consider the use of
3602 * "panel_bounds()" to allow "off-panel" targets, perhaps by using
3603 * some form of "scrolling" the map around the cursor. XXX XXX XXX
3604 * That is, consider the possibility of "auto-scrolling" the screen
3605 * while the cursor moves around. This may require changes in the
3606 * "update_mon()" code to allow "visibility" even if off panel, and
3607 * may require dynamic recalculation of the "temp" grid set.
3609 * Hack -- targeting/observing an "outer border grid" may induce
3610 * problems, so this is not currently allowed.
3612 * The player can use the direction keys to move among "interesting"
3613 * grids in a heuristic manner, or the "space", "+", and "-" keys to
3614 * move through the "interesting" grids in a sequential manner, or
3615 * can enter "location" mode, and use the direction keys to move one
3616 * grid at a time in any direction. The "t" (set target) command will
3617 * only target a monster (as opposed to a location) if the monster is
3618 * target_able and the "interesting" mode is being used.
3620 * The current grid is described using the "look" method above, and
3621 * a new command may be entered at any time, but note that if the
3622 * "TARGET_LOOK" bit flag is set (or if we are in "location" mode,
3623 * where "space" has no obvious meaning) then "space" will scan
3624 * through the description of the current grid until done, instead
3625 * of immediately jumping to the next "interesting" grid. This
3626 * allows the "target" command to retain its old semantics.
3628 * The "*", "+", and "-" keys may always be used to jump immediately
3629 * to the next (or previous) interesting grid, in the proper mode.
3631 * The "return" key may always be used to scan through a complete
3632 * grid description (forever).
3634 * This command will cancel any old target, even if used from
3635 * inside the "look" command.
3637 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 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 if (!(mode & TARGET_LOOK)) prt_path(y, x);
3926 c_ptr = &cave[y][x];
3928 /* Default prompt */
3930 strcpy(info, "q»ß t·è p¼« m¶á +¼¡ -Á°");
3932 strcpy(info, "q,t,p,m,+,-,<dir>");
3936 /* Describe and Prompt (enable "TARGET_LOOK") */
3937 query = target_set_aux(y, x, mode | TARGET_LOOK, info);
3939 /* Cancel tracking */
3940 /* health_track(0); */
3942 /* Assume no direction */
3947 if (query == '\r') query = 't';
3950 /* Analyze the keypress */
3974 /* Recenter the map around the player */
3978 p_ptr->update |= (PU_MONSTERS);
3981 p_ptr->redraw |= (PR_MAP);
3984 p_ptr->window |= (PW_OVERHEAD);
3989 /* Recalculate interesting grids */
3990 target_set_prepare(mode);
4012 /* Pick a nearby monster */
4013 for (i = 0; i < temp_n; i++)
4015 t = distance(y, x, temp_y[i], temp_x[i]);
4025 /* Nothing interesting */
4026 if (bd == 999) flag = FALSE;
4033 /* Extract the action (if any) */
4034 d = get_keymap_dir(query);
4041 /* Handle "direction" */
4051 /* Do not move horizontally if unnecessary */
4052 if (((x < panel_col_min + wid / 2) && (dx > 0)) ||
4053 ((x > panel_col_min + wid / 2) && (dx < 0)))
4058 /* Do not move vertically if unnecessary */
4059 if (((y < panel_row_min + hgt / 2) && (dy > 0)) ||
4060 ((y > panel_row_min + hgt / 2) && (dy < 0)))
4065 /* Apply the motion */
4066 if ((y >= panel_row_min + hgt) || (y < panel_row_min) ||
4067 (x >= panel_col_min + wid) || (x < panel_col_min))
4069 if (change_panel(dy, dx)) target_set_prepare(mode);
4072 /* Slide into legality */
4073 if (x >= cur_wid-1) x = cur_wid - 2;
4074 else if (x <= 0) x = 1;
4076 /* Slide into legality */
4077 if (y >= cur_hgt-1) y = cur_hgt- 2;
4078 else if (y <= 0) y = 1;
4086 /* Clear the top line */
4089 /* Recenter the map around the player */
4093 p_ptr->update |= (PU_MONSTERS);
4096 p_ptr->redraw |= (PR_MAP);
4099 p_ptr->window |= (PW_OVERHEAD);
4104 /* Failure to set target */
4105 if (!target_who) return (FALSE);
4113 * Get an "aiming direction" from the user.
4115 * The "dir" is loaded with 1,2,3,4,6,7,8,9 for "actual direction", and
4116 * "0" for "current target", and "-1" for "entry aborted".
4118 * Note that "Force Target", if set, will pre-empt user interaction,
4119 * if there is a usable target already set.
4121 * Note that confusion over-rides any (explicit?) user choice.
4123 bool get_aim_dir(int *dp)
4134 /* Global direction */
4137 /* Hack -- auto-target if requested */
4138 if (use_old_target && target_okay()) dir = 5;
4140 #ifdef ALLOW_REPEAT /* TNB */
4142 if (repeat_pull(dp))
4147 if (!(*dp == 5 && !target_okay()))
4149 /* return (TRUE); */
4154 #endif /* ALLOW_REPEAT -- TNB */
4156 /* Ask until satisfied */
4159 /* Choose a prompt */
4163 p = "Êý¸þ ('*'¤Ç¥¿¡¼¥²¥Ã¥ÈÁªÂò, ESC¤ÇÃæÃÇ)? ";
4165 p = "Direction ('*' to choose a target, Escape to cancel)? ";
4172 p = "Êý¸þ ('5'¤Ç¥¿¡¼¥²¥Ã¥È¤Ø, '*'¤Ç¥¿¡¼¥²¥Ã¥ÈºÆÁªÂò, ESC¤ÇÃæÃÇ)? ";
4174 p = "Direction ('5' for target, '*' to re-target, Escape to cancel)? ";
4179 /* Get a command (or Cancel) */
4180 if (!get_com(p, &command, TRUE)) break;
4184 if (command == '\r') command = 't';
4187 /* Convert various keys to "standard" keys */
4190 /* Use current target */
4201 /* Set new target */
4206 if (target_set(TARGET_KILL)) dir = 5;
4212 /* Extract the action (if any) */
4213 dir = get_keymap_dir(command);
4219 /* Verify requested targets */
4220 if ((dir == 5) && !target_okay()) dir = 0;
4229 project_length = 0; /* reset to default */
4233 /* Save the direction */
4236 /* Check for confusion */
4237 if (p_ptr->confused)
4240 /* Random direction */
4241 dir = ddd[randint0(8)];
4244 /* Notice confusion */
4245 if (command_dir != dir)
4249 msg_print("¤¢¤Ê¤¿¤Ïº®Í𤷤Ƥ¤¤ë¡£");
4251 msg_print("You are confused.");
4256 /* Save direction */
4259 #ifdef ALLOW_REPEAT /* TNB */
4261 /* repeat_push(dir); */
4262 repeat_push(command_dir);
4264 #endif /* ALLOW_REPEAT -- TNB */
4266 /* A "valid" direction was entered */
4273 * Request a "movement" direction (1,2,3,4,6,7,8,9) from the user,
4274 * and place it into "command_dir", unless we already have one.
4276 * This function should be used for all "repeatable" commands, such as
4277 * run, walk, open, close, bash, disarm, spike, tunnel, etc, as well
4278 * as all commands which must reference a grid adjacent to the player,
4279 * and which may not reference the grid under the player. Note that,
4280 * for example, it is no longer possible to "disarm" or "open" chests
4281 * in the same grid as the player.
4283 * Direction "5" is illegal and will (cleanly) abort the command.
4285 * This function tracks and uses the "global direction", and uses
4286 * that as the "desired direction", to which "confusion" is applied.
4288 bool get_rep_dir(int *dp, bool under)
4295 /* Global direction */
4298 #ifdef ALLOW_REPEAT /* TNB */
4300 if (repeat_pull(dp))
4303 /* return (TRUE); */
4306 #endif /* ALLOW_REPEAT -- TNB */
4308 /* Get a direction */
4313 /* Get a command (or Cancel) */
4315 if (!get_com("Êý¸þ (ESC¤ÇÃæÃÇ)? ", &ch, TRUE)) break;
4317 if (!get_com("Direction (Escape to cancel)? ", &ch, TRUE)) break;
4321 /* Look up the direction */
4322 dir = get_keymap_dir(ch);
4328 /* Prevent weirdness */
4329 if ((dir == 5) && (!under)) dir = 0;
4332 if (!dir) return (FALSE);
4334 /* Save desired direction */
4337 /* Apply "confusion" */
4338 if (p_ptr->confused)
4340 /* Standard confusion */
4341 if (randint0(100) < 75)
4343 /* Random direction */
4344 dir = ddd[randint0(8)];
4347 else if (p_ptr->riding)
4349 monster_type *m_ptr = &m_list[p_ptr->riding];
4350 monster_race *r_ptr = &r_info[m_ptr->ap_r_idx];
4352 if (m_ptr->confused)
4354 /* Standard confusion */
4355 if (randint0(100) < 75)
4357 /* Random direction */
4358 dir = ddd[randint0(8)];
4361 else if ((r_ptr->flags1 & RF1_RAND_50) && (r_ptr->flags1 & RF1_RAND_25) && (randint0(100) < 50))
4363 /* Random direction */
4364 dir = ddd[randint0(8)];
4366 else if ((r_ptr->flags1 & RF1_RAND_50) && (randint0(100) < 25))
4368 /* Random direction */
4369 dir = ddd[randint0(8)];
4373 /* Notice confusion */
4374 if (command_dir != dir)
4376 if (p_ptr->confused)
4380 msg_print("¤¢¤Ê¤¿¤Ïº®Í𤷤Ƥ¤¤ë¡£");
4382 msg_print("You are confused.");
4388 monster_type *m_ptr = &m_list[p_ptr->riding];
4390 monster_desc(m_name, m_ptr, 0);
4391 if (m_ptr->confused)
4394 msg_format("%s¤Ïº®Í𤷤Ƥ¤¤ë¡£", m_name);
4396 msg_format("%^s is confusing.", m_name);
4403 msg_format("%s¤Ï»×¤¤Ä̤ê¤ËÆ°¤¤¤Æ¤¯¤ì¤Ê¤¤¡£", m_name);
4405 msg_format("You cannot control %s.", m_name);
4411 /* Save direction */
4414 #ifdef ALLOW_REPEAT /* TNB */
4416 /* repeat_push(dir); */
4417 repeat_push(command_dir);
4419 #endif /* ALLOW_REPEAT -- TNB */
4426 bool get_rep_dir2(int *dp)
4433 /* Global direction */
4436 #ifdef ALLOW_REPEAT /* TNB */
4438 if (repeat_pull(dp))
4441 /* return (TRUE); */
4444 #endif /* ALLOW_REPEAT -- TNB */
4446 /* Get a direction */
4451 /* Get a command (or Cancel) */
4453 if (!get_com("Êý¸þ (ESC¤ÇÃæÃÇ)? ", &ch, TRUE)) break;
4455 if (!get_com("Direction (Escape to cancel)? ", &ch, TRUE)) break;
4459 /* Look up the direction */
4460 dir = get_keymap_dir(ch);
4466 /* Prevent weirdness */
4467 if (dir == 5) dir = 0;
4470 if (!dir) return (FALSE);
4472 /* Save desired direction */
4475 /* Apply "confusion" */
4476 if (p_ptr->confused)
4478 /* Standard confusion */
4479 if (randint0(100) < 75)
4481 /* Random direction */
4482 dir = ddd[randint0(8)];
4486 /* Notice confusion */
4487 if (command_dir != dir)
4491 msg_print("¤¢¤Ê¤¿¤Ïº®Í𤷤Ƥ¤¤ë¡£");
4493 msg_print("You are confused.");
4498 /* Save direction */
4501 #ifdef ALLOW_REPEAT /* TNB */
4503 /* repeat_push(dir); */
4504 repeat_push(command_dir);
4506 #endif /* ALLOW_REPEAT -- TNB */
4513 int get_chaos_patron(void)
4515 return ((p_ptr->age + p_ptr->sc) % MAX_PATRON);
4519 void gain_level_reward(int chosen_reward)
4523 char wrath_reason[32] = "";
4524 int nasty_chance = 6;
4525 int dummy = 0, dummy2 = 0;
4528 char o_name[MAX_NLEN];
4534 if (multi_rew) return;
4535 else multi_rew = TRUE;
4539 if (p_ptr->lev == 13) nasty_chance = 2;
4540 else if (!(p_ptr->lev % 13)) nasty_chance = 3;
4541 else if (!(p_ptr->lev % 14)) nasty_chance = 12;
4543 if (one_in_(nasty_chance))
4544 type = randint1(20); /* Allow the 'nasty' effects */
4546 type = randint1(15) + 5; /* Or disallow them */
4548 if (type < 1) type = 1;
4549 if (type > 20) type = 20;
4554 sprintf(wrath_reason, "%s¤ÎÅܤê",
4555 chaos_patrons[p_ptr->chaos_patron]);
4557 sprintf(wrath_reason, "the Wrath of %s",
4558 chaos_patrons[p_ptr->chaos_patron]);
4562 effect = chaos_rewards[p_ptr->chaos_patron][type];
4564 if (one_in_(6) && !chosen_reward)
4567 msg_format("%^s¤ÏË«Èþ¤È¤·¤Æ¤¢¤Ê¤¿¤òÆÍÁ³ÊÑ°Û¤µ¤»¤¿¡£",
4568 chaos_patrons[p_ptr->chaos_patron]);
4570 msg_format("%^s rewards you with a mutation!",
4571 chaos_patrons[p_ptr->chaos_patron]);
4574 (void)gain_random_mutation(0);
4576 reward = "ÊÑ°Û¤·¤¿¡£";
4578 reward = "mutation";
4583 switch (chosen_reward ? chosen_reward : effect)
4587 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
4588 chaos_patrons[p_ptr->chaos_patron]);
4590 msg_format("The voice of %s booms out:",
4591 chaos_patrons[p_ptr->chaos_patron]);
4595 msg_print("¡ÖÆò¡¢¿·¤¿¤Ê¤ë»Ñ¤òɬÍפȤ»¤ê¡ª¡×");
4597 msg_print("'Thou needst a new form, mortal!'");
4602 reward = "ÊÑ°Û¤·¤¿¡£";
4604 reward = "polymorphing";
4609 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
4610 chaos_patrons[p_ptr->chaos_patron]);
4612 msg_format("The voice of %s booms out:",
4613 chaos_patrons[p_ptr->chaos_patron]);
4617 msg_print("¡ÖÆò¤ÏÎɤ¯¹Ô¤¤¤¿¤ê¡ªÂ³¤±¤è¡ª¡×");
4619 msg_print("'Well done, mortal! Lead on!'");
4622 if (p_ptr->prace == RACE_ANDROID)
4625 msg_print("¤·¤«¤·²¿¤âµ¯¤³¤é¤Ê¤«¤Ã¤¿¡£");
4627 msg_print("But, nothing happen.");
4630 else if (p_ptr->exp < PY_MAX_EXP)
4632 s32b ee = (p_ptr->exp / 2) + 10;
4633 if (ee > 100000L) ee = 100000L;
4635 msg_print("¹¹¤Ë·Ð¸³¤òÀѤó¤À¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£");
4637 msg_print("You feel more experienced.");
4642 reward = "·Ð¸³ÃͤòÆÀ¤¿";
4644 reward = "experience";
4650 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
4651 chaos_patrons[p_ptr->chaos_patron]);
4653 msg_format("The voice of %s booms out:",
4654 chaos_patrons[p_ptr->chaos_patron]);
4658 msg_print("¡Ö²¼Ëͤ衢Æò¤½¤ì¤ËÃͤ»¤º¡£¡×");
4660 msg_print("'Thou didst not deserve that, slave.'");
4663 if (p_ptr->prace == RACE_ANDROID)
4666 msg_print("¤·¤«¤·²¿¤âµ¯¤³¤é¤Ê¤«¤Ã¤¿¡£");
4668 msg_print("But, nothing happen.");
4673 lose_exp(p_ptr->exp / 6);
4675 reward = "·Ð¸³Ãͤò¼º¤Ã¤¿¡£";
4677 reward = "losing experience";
4683 msg_format("%s¤ÎÀ¼¤¬¤µ¤µ¤ä¤¤¤¿:",
4684 chaos_patrons[p_ptr->chaos_patron]);
4686 msg_format("The voice of %s whispers:",
4687 chaos_patrons[p_ptr->chaos_patron]);
4691 msg_print("¡Ö²æ¤¬Í¿¤¨¤·Êª¤ò¸ÌÀ¤Ë»È¤¦¤Ù¤·¡£¡×");
4693 msg_print("'Use my gift wisely.'");
4696 acquirement(py, px, 1, FALSE, FALSE);
4698 reward = "¾å¼Á¤Ê¥¢¥¤¥Æ¥à¤ò¼ê¤ËÆþ¤ì¤¿¡£";
4700 reward = "a good item";
4705 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
4706 chaos_patrons[p_ptr->chaos_patron]);
4708 msg_format("The voice of %s booms out:",
4709 chaos_patrons[p_ptr->chaos_patron]);
4713 msg_print("¡Ö²æ¤¬Í¿¤¨¤·Êª¤ò¸ÌÀ¤Ë»È¤¦¤Ù¤·¡£¡×");
4715 msg_print("'Use my gift wisely.'");
4718 acquirement(py, px, 1, TRUE, FALSE);
4720 reward = "¹âµéÉʤΥ¢¥¤¥Æ¥à¤ò¼ê¤ËÆþ¤ì¤¿¡£";
4722 reward = "an excellent item";
4727 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
4728 chaos_patrons[p_ptr->chaos_patron]);
4730 msg_format("The voice of %s booms out:",
4731 chaos_patrons[p_ptr->chaos_patron]);
4735 msg_print("¡ÖÆò¤Î¹Ô¤¤¤Ïµ®¤·õ¤ËÃͤ»¤ê¡£¡×");
4737 msg_print("'Thy deed hath earned thee a worthy blade.'");
4740 /* Get local object */
4743 switch (randint1(p_ptr->lev))
4749 dummy2 = SV_MAIN_GAUCHE;
4758 dummy2 = SV_SMALL_SWORD;
4761 dummy2 = SV_BASILLARD;
4763 case 11: case 12: case 13:
4764 dummy2 = SV_SHORT_SWORD;
4770 dummy2 = SV_CUTLASS;
4773 dummy2 = SV_WAKIZASHI;
4776 dummy2 = SV_KHOPESH;
4782 dummy2 = SV_BROAD_SWORD;
4785 dummy2 = SV_LONG_SWORD;
4788 dummy2 = SV_SCIMITAR;
4791 dummy2 = SV_NINJATO;
4797 dummy2 = SV_BASTARD_SWORD;
4800 dummy2 = SV_GREAT_SCIMITAR;
4803 dummy2 = SV_CLAYMORE;
4806 dummy2 = SV_ESPADON;
4809 dummy2 = SV_TWO_HANDED_SWORD;
4812 dummy2 = SV_FLAMBERGE;
4815 dummy2 = SV_NO_DACHI;
4818 dummy2 = SV_EXECUTIONERS_SWORD;
4821 dummy2 = SV_ZWEIHANDER;
4824 dummy2 = SV_HAYABUSA;
4827 dummy2 = SV_BLADE_OF_CHAOS;
4830 object_prep(q_ptr, lookup_kind(dummy, dummy2));
4831 q_ptr->to_h = 3 + randint1(dun_level) % 10;
4832 q_ptr->to_d = 3 + randint1(dun_level) % 10;
4833 one_resistance(q_ptr);
4834 q_ptr->name2 = EGO_CHAOTIC;
4836 /* Drop it in the dungeon */
4837 (void)drop_near(q_ptr, -1, py, px);
4839 reward = "(º®ÆÙ)¤ÎÉð´ï¤ò¼ê¤ËÆþ¤ì¤¿¡£";
4841 reward = "chaos weapon";
4846 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
4847 chaos_patrons[p_ptr->chaos_patron]);
4849 msg_format("The voice of %s booms out:",
4850 chaos_patrons[p_ptr->chaos_patron]);
4854 msg_print("¡ÖÆò¤Î¹Ô¤¤¤Ïµ®¤Ê󤤤ËÃͤ»¤ê¡£¡×");
4856 msg_print("'Thy deed hath earned thee a worthy reward.'");
4859 acquirement(py, px, randint1(2) + 1, FALSE, FALSE);
4861 reward = "¾å¼Á¤Ê¥¢¥¤¥Æ¥à¤ò¼ê¤ËÆþ¤ì¤¿¡£";
4863 reward = "good items";
4868 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
4869 chaos_patrons[p_ptr->chaos_patron]);
4871 msg_format("The voice of %s booms out:",
4872 chaos_patrons[p_ptr->chaos_patron]);
4876 msg_print("¡Ö²¼Ëͤ衢Æò¤Î¸¥¿È¤Ø¤Î²æ¤¬Àˤ·¤ß̵¤Ê󤤤ò¸«¤ë¤¬¤è¤¤¡£¡×");
4878 msg_print("'Behold, mortal, how generously I reward thy loyalty.'");
4881 acquirement(py, px, randint1(2) + 1, TRUE, FALSE);
4883 reward = "¹âµéÉʤΥ¢¥¤¥Æ¥à¤ò¼ê¤ËÆþ¤ì¤¿¡£";
4885 reward = "excellent items";
4890 msg_format("%s¤ÎÀ¼¤¬¹ì¤ÅϤä¿:",
4891 chaos_patrons[p_ptr->chaos_patron]);
4893 msg_format("The voice of %s thunders:",
4894 chaos_patrons[p_ptr->chaos_patron]);
4898 msg_print("¡Ö²¼Ëͤ衢ÆòÐþËý¤Ê¤ê¡£¡×");
4900 msg_print("'Thou art growing arrogant, mortal.'");
4903 (void)activate_ty_curse(FALSE, &count);
4905 reward = "²Ò¡¹¤·¤¤¼ö¤¤¤ò¤«¤±¤é¤ì¤¿¡£";
4912 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
4913 chaos_patrons[p_ptr->chaos_patron]);
4915 msg_format("The voice of %s booms out:",
4916 chaos_patrons[p_ptr->chaos_patron]);
4920 msg_print("¡Ö²æ¤¬²¼Ëͤ¿¤Á¤è¡¢¤«¤ÎÐþËý¤Ê¤ë¼Ô¤òÅݤ¹¤Ù¤·¡ª¡×");
4922 msg_print("'My pets, destroy the arrogant mortal!'");
4925 for (dummy = 0; dummy < randint1(5) + 1; dummy++)
4927 (void)summon_specific(0, py, px, dun_level, 0, TRUE, FALSE, FALSE, TRUE, TRUE);
4930 reward = "¥â¥ó¥¹¥¿¡¼¤ò¾¤´¤µ¤ì¤¿¡£";
4932 reward = "summoning hostile monsters";
4937 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
4938 chaos_patrons[p_ptr->chaos_patron]);
4940 msg_format("The voice of %s booms out:",
4941 chaos_patrons[p_ptr->chaos_patron]);
4945 msg_print("¡ÖÆò¡¢¤è¤ê¶¯¤Å¨¤òɬÍפȤ»¤ê¡ª¡×");
4947 msg_print("'Thou needst worthier opponents!'");
4950 activate_hi_summon(py, px, FALSE);
4952 reward = "¥â¥ó¥¹¥¿¡¼¤ò¾¤´¤µ¤ì¤¿¡£";
4954 reward = "summoning many hostile monsters";
4959 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
4960 chaos_patrons[p_ptr->chaos_patron]);
4962 msg_format("The voice of %s booms out:",
4963 chaos_patrons[p_ptr->chaos_patron]);
4967 msg_print("¡Ö»à¤ÈÇ˲õ¤³¤½²æ¤¬´î¤Ó¤Ê¤ê¡ª¡×");
4969 msg_print("'Death and destruction! This pleaseth me!'");
4974 reward = "¥«¥ª¥¹¤ÎÎϤ¬±²´¬¤¤¤¿¡£";
4976 reward = "calling chaos";
4981 msg_format("%s¤ÎÀ¼¤¬ÌĤê¶Á¤¤¤¿:",
4982 chaos_patrons[p_ptr->chaos_patron]);
4984 msg_format("The voice of %s rings out:",
4985 chaos_patrons[p_ptr->chaos_patron]);
4989 msg_print("¡Öα¤Þ¤ë¤Î¤À¡¢²¼Ëͤ衣;¤¬Æò¤ÎÆùÂΤòÃ䨤󡣡×");
4991 msg_print("'Stay, mortal, and let me mold thee.'");
4994 if (one_in_(3) && !(chaos_stats[p_ptr->chaos_patron] < 0))
4995 do_inc_stat(chaos_stats[p_ptr->chaos_patron]);
4997 do_inc_stat(randint0(6));
4999 reward = "ǽÎÏÃͤ¬¾å¤¬¤Ã¤¿¡£";
5001 reward = "increasing a stat";
5006 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5007 chaos_patrons[p_ptr->chaos_patron]);
5009 msg_format("The voice of %s booms out:",
5010 chaos_patrons[p_ptr->chaos_patron]);
5014 msg_print("¡Ö²¼Ëͤ衢;¤ÏÆò¤ËË°¤ß¤¿¤ê¡£¡×");
5016 msg_print("'I grow tired of thee, mortal.'");
5019 if (one_in_(3) && !(chaos_stats[p_ptr->chaos_patron] < 0))
5020 do_dec_stat(chaos_stats[p_ptr->chaos_patron]);
5022 (void)do_dec_stat(randint0(6));
5024 reward = "ǽÎÏÃͤ¬²¼¤¬¤Ã¤¿¡£";
5026 reward = "decreasing a stat";
5031 msg_format("%s¤ÎÀ¼¤¬¹ì¤ÅϤä¿:",
5032 chaos_patrons[p_ptr->chaos_patron]);
5034 msg_format("The voice of %s thunders:",
5035 chaos_patrons[p_ptr->chaos_patron]);
5039 msg_print("¡ÖÆò¡¢¸¬µõ¤¿¤ë¤³¤È¤ò³Ø¤Ö¤Ù¤·¡ª¡×");
5040 msg_print("¤¢¤Ê¤¿¤Ï°ÊÁ°¤è¤ê¼å¤¯¤Ê¤Ã¤¿¡ª");
5042 msg_print("'Thou needst a lesson in humility, mortal!'");
5043 msg_print("You feel less powerful!");
5046 for (dummy = 0; dummy < 6; dummy++)
5048 (void)dec_stat(dummy, 10 + randint1(15), TRUE);
5051 reward = "Á´Ç½ÎÏÃͤ¬²¼¤¬¤Ã¤¿¡£";
5053 reward = "decreasing all stats";
5058 msg_format("%s¤ÎÎϤ¬¿¨¤ì¤ë¤Î¤ò´¶¤¸¤¿¡£",
5060 msg_format("You feel the power of %s touch you.",
5063 chaos_patrons[p_ptr->chaos_patron]);
5066 reward = "½ý¤¬ÊѲ½¤·¤¿¡£";
5068 reward = "polymorphing wounds";
5073 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5074 chaos_patrons[p_ptr->chaos_patron]);
5076 msg_format("The voice of %s booms out:",
5077 chaos_patrons[p_ptr->chaos_patron]);
5081 msg_print("¡Ö²æ¤¬¤µ¤µ¤ä¤«¤Ê¤ë»òʪ¤ò¼õ¤±¤È¤ë¤¬¤è¤¤¡ª¡×");
5083 msg_print("'Receive this modest gift from me!'");
5086 for (dummy = 0; dummy < 6; dummy++)
5088 (void)do_inc_stat(dummy);
5091 reward = "Á´Ç½ÎÏÃͤ¬¾å¤¬¤Ã¤¿¡£";
5093 reward = "increasing all stats";
5098 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5099 chaos_patrons[p_ptr->chaos_patron]);
5101 msg_format("The voice of %s booms out:",
5102 chaos_patrons[p_ptr->chaos_patron]);
5106 msg_print("¡Ö¶ì¤·¤à¤¬¤è¤¤¡¢ÌµÇ½¤Ê¶ò¤«¼Ô¤è¡ª¡×");
5108 msg_print("'Suffer, pathetic fool!'");
5111 fire_ball(GF_DISINTEGRATE, 0, p_ptr->lev * 4, 4);
5112 take_hit(DAMAGE_NOESCAPE, p_ptr->lev * 4, wrath_reason, -1);
5114 reward = "ʬ²ò¤Îµå¤¬È¯À¸¤·¤¿¡£";
5116 reward = "generating disintegration ball";
5121 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5122 chaos_patrons[p_ptr->chaos_patron]);
5124 msg_format("The voice of %s booms out:",
5125 chaos_patrons[p_ptr->chaos_patron]);
5129 msg_print("¡Öᴤ뤬¤è¤¤¡¢²æ¤¬²¼Ëͤ衪¡×");
5131 msg_print("'Rise, my servant!'");
5135 (void)set_poisoned(0);
5137 (void)set_confused(0);
5142 for (dummy = 0; dummy < 6; dummy++)
5144 (void)do_res_stat(dummy);
5147 reward = "ÂÎÎϤ¬²óÉü¤·¤¿¡£";
5153 if (!buki_motteruka(INVEN_RARM)) break;
5155 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5156 chaos_patrons[p_ptr->chaos_patron]);
5158 msg_format("The voice of %s booms out:",
5159 chaos_patrons[p_ptr->chaos_patron]);
5163 msg_print("¡ÖÆò¡¢Éð´ï¤ËÍê¤ë¤³¤È¤Ê¤«¤ì¡£¡×");
5165 msg_print("'Thou reliest too much on thy weapon.'");
5168 object_desc(o_name, &inventory[INVEN_RARM], TRUE, 0);
5169 (void)curse_weapon(FALSE, INVEN_RARM);
5171 reward = format("%s¤¬Ç˲õ¤µ¤ì¤¿¡£", o_name);
5173 reward = format("destroying %s", o_name);
5177 if (!inventory[INVEN_BODY].k_idx) break;
5179 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5180 chaos_patrons[p_ptr->chaos_patron]);
5182 msg_format("The voice of %s booms out:",
5183 chaos_patrons[p_ptr->chaos_patron]);
5187 msg_print("¡ÖÆò¡¢Ëɶñ¤ËÍê¤ë¤³¤È¤Ê¤«¤ì¡£¡×");
5189 msg_print("'Thou reliest too much on thine equipment.'");
5192 object_desc(o_name, &inventory[INVEN_BODY], TRUE, 0);
5193 (void)curse_armor();
5195 reward = format("%s¤¬Ç˲õ¤µ¤ì¤¿¡£", o_name);
5197 reward = format("destroying %s", o_name);
5202 msg_format("%s¤ÎÀ¼¤¬¤µ¤µ¤ä¤¤¤¿:",
5203 chaos_patrons[p_ptr->chaos_patron]);
5205 msg_format("The voice of %s whispers:",
5206 chaos_patrons[p_ptr->chaos_patron]);
5210 msg_print("¡Ö²æ¤òÅܤꤷ¤á¤¿ºá¤ò½þ¤¦¤Ù¤·¡£¡×");
5212 msg_print("'Now thou shalt pay for annoying me.'");
5215 switch (randint1(4))
5218 (void)activate_ty_curse(FALSE, &count);
5220 reward = "²Ò¡¹¤·¤¤¼ö¤¤¤ò¤«¤±¤é¤ì¤¿¡£";
5226 activate_hi_summon(py, px, FALSE);
5228 reward = "¥â¥ó¥¹¥¿¡¼¤ò¾¤´¤µ¤ì¤¿¡£";
5230 reward = "summoning hostile monsters";
5236 if (!buki_motteruka(INVEN_RARM)) break;
5237 object_desc(o_name, &inventory[INVEN_RARM], TRUE, 0);
5238 (void)curse_weapon(FALSE, INVEN_RARM);
5240 reward = format("%s¤¬Ç˲õ¤µ¤ì¤¿¡£", o_name);
5242 reward = format("destroying %s", o_name);
5247 if (!inventory[INVEN_BODY].k_idx) break;
5248 object_desc(o_name, &inventory[INVEN_BODY], TRUE, 0);
5249 (void)curse_armor();
5251 reward = format("%s¤¬Ç˲õ¤µ¤ì¤¿¡£", o_name);
5253 reward = format("destroying %s", o_name);
5258 for (dummy = 0; dummy < 6; dummy++)
5260 (void)dec_stat(dummy, 10 + randint1(15), TRUE);
5263 reward = "Á´Ç½ÎÏÃͤ¬²¼¤¬¤Ã¤¿¡£";
5265 reward = "decreasing all stats";
5272 msg_format("%s¤ÎÀ¼¤¬¹ì¤ÅϤä¿:",
5274 msg_format("The voice of %s thunders:",
5277 chaos_patrons[p_ptr->chaos_patron]);
5279 msg_print("¡Ö»à¤Ì¤¬¤è¤¤¡¢²¼Ëͤ衪¡×");
5281 msg_print("'Die, mortal!'");
5284 take_hit(DAMAGE_LOSELIFE, p_ptr->lev * 4, wrath_reason, -1);
5285 for (dummy = 0; dummy < 6; dummy++)
5287 (void)dec_stat(dummy, 10 + randint1(15), FALSE);
5289 activate_hi_summon(py, px, FALSE);
5290 (void)activate_ty_curse(FALSE, &count);
5291 if (one_in_(2)) (void)curse_weapon(FALSE, INVEN_RARM);
5292 if (one_in_(2)) (void)curse_armor();
5296 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5297 chaos_patrons[p_ptr->chaos_patron]);
5299 msg_format("The voice of %s booms out:",
5300 chaos_patrons[p_ptr->chaos_patron]);
5304 msg_print("¡Ö»à¤ÈÇ˲õ¤³¤½²æ¤¬´î¤Ó¤Ê¤ê¡ª¡×");
5306 msg_print("'Death and destruction! This pleaseth me!'");
5309 destroy_area(py, px, 25, TRUE);
5311 reward = "¥À¥ó¥¸¥ç¥ó¤¬*Ç˲õ*¤µ¤ì¤¿¡£";
5313 reward = "*destruct*ing dungeon";
5318 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5319 chaos_patrons[p_ptr->chaos_patron]);
5321 msg_format("The voice of %s booms out:",
5322 chaos_patrons[p_ptr->chaos_patron]);
5326 msg_print("¡Ö²æ¡¢Æò¤ÎŨ¤òËõ»¦¤»¤ó¡ª¡×");
5328 msg_print("'Let me relieve thee of thine oppressors!'");
5331 (void)symbol_genocide(0, FALSE);
5333 reward = "¥â¥ó¥¹¥¿¡¼¤¬Ëõ»¦¤µ¤ì¤¿¡£";
5335 reward = "genociding monsters";
5340 msg_format("%s¤ÎÀ¼¤¬¶Á¤ÅϤä¿:",
5341 chaos_patrons[p_ptr->chaos_patron]);
5343 msg_format("The voice of %s booms out:",
5344 chaos_patrons[p_ptr->chaos_patron]);
5348 msg_print("¡Ö²æ¡¢Æò¤ÎŨ¤òËõ»¦¤»¤ó¡ª¡×");
5350 msg_print("'Let me relieve thee of thine oppressors!'");
5353 (void)mass_genocide(0, FALSE);
5355 reward = "¥â¥ó¥¹¥¿¡¼¤¬Ëõ»¦¤µ¤ì¤¿¡£";
5357 reward = "genociding nearby monsters";
5362 msg_format("%s¤ÎÎϤ¬Å¨¤ò¹¶·â¤¹¤ë¤Î¤ò´¶¤¸¤¿¡ª",
5363 chaos_patrons[p_ptr->chaos_patron]);
5365 msg_format("You can feel the power of %s assault your enemies!",
5366 chaos_patrons[p_ptr->chaos_patron]);
5369 (void)dispel_monsters(p_ptr->lev * 4);
5373 msg_format("%s¤Ï¤¢¤Ê¤¿¤ò̵»ë¤·¤¿¡£",
5374 chaos_patrons[p_ptr->chaos_patron]);
5376 msg_format("%s ignores you.",
5377 chaos_patrons[p_ptr->chaos_patron]);
5383 msg_format("%s¤ÏË«Èþ¤È¤·¤Æ°Ëâ¤Î»È¤¤¤ò¤è¤³¤·¤¿¡ª",chaos_patrons[p_ptr->chaos_patron]);
5385 msg_format("%s rewards you with a demonic servant!",chaos_patrons[p_ptr->chaos_patron]);
5388 if (!summon_specific(-1, py, px, dun_level, SUMMON_DEMON, FALSE, TRUE, TRUE, FALSE, FALSE))
5390 msg_print("²¿¤â¸½¤ì¤Ê¤«¤Ã¤¿...");
5392 msg_print("Nobody ever turns up...");
5396 reward = "°Ë⤬¥Ú¥Ã¥È¤Ë¤Ê¤Ã¤¿¡£";
5398 reward = "a demonic servant";
5404 msg_format("%s¤ÏË«Èþ¤È¤·¤Æ»È¤¤¤ò¤è¤³¤·¤¿¡ª",chaos_patrons[p_ptr->chaos_patron]);
5406 msg_format("%s rewards you with a servant!",chaos_patrons[p_ptr->chaos_patron]);
5409 if (!summon_specific(-1, py, px, dun_level, 0, FALSE, TRUE, TRUE, FALSE, FALSE))
5411 msg_print("²¿¤â¸½¤ì¤Ê¤«¤Ã¤¿...");
5413 msg_print("Nobody ever turns up...");
5417 reward = "¥â¥ó¥¹¥¿¡¼¤¬¥Ú¥Ã¥È¤Ë¤Ê¤Ã¤¿¡£";
5419 reward = "a servant";
5425 msg_format("%s¤ÏË«Èþ¤È¤·¤Æ¥¢¥ó¥Ç¥Ã¥É¤Î»È¤¤¤ò¤è¤³¤·¤¿¡£",chaos_patrons[p_ptr->chaos_patron]);
5427 msg_format("%s rewards you with an undead servant!",chaos_patrons[p_ptr->chaos_patron]);
5430 if (!summon_specific(-1, py, px, dun_level, SUMMON_UNDEAD, FALSE, TRUE, TRUE, FALSE, FALSE))
5432 msg_print("²¿¤â¸½¤ì¤Ê¤«¤Ã¤¿...");
5434 msg_print("Nobody ever turns up...");
5438 reward = "¥¢¥ó¥Ç¥Ã¥É¤¬¥Ú¥Ã¥È¤Ë¤Ê¤Ã¤¿¡£";
5440 reward = "an undead servant";
5446 msg_format("%s¤ÎÀ¼¤¬¤É¤â¤Ã¤¿:",
5448 msg_format("The voice of %s stammers:",
5451 chaos_patrons[p_ptr->chaos_patron]);
5453 msg_format("¡Ö¤¢¡¼¡¢¤¢¡¼¡¢Åú¤¨¤Ï %d/%d¡£¼ÁÌä¤Ï²¿¡©¡×", type, effect);
5455 msg_format("'Uh... uh... the answer's %d/%d, what's the question?'", type, effect);
5463 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, format("¥Ñ¥È¥í¥ó¤ÎÊó½·¤Ç%s", reward));
5465 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, format("The patron rewards you with %s.", reward));
5472 * old -- from PsiAngband.
5474 bool tgt_pt(int *x_ptr, int *y_ptr)
5478 bool success = FALSE;
5483 get_screen_size(&wid, &hgt);
5489 msg_print("¾ì½ê¤òÁª¤ó¤Ç¥¹¥Ú¡¼¥¹¥¡¼¤ò²¡¤·¤Æ²¼¤µ¤¤¡£");
5491 msg_print("Select a point and press space.");
5493 msg_flag = FALSE; /* prevents "-more-" message. */
5495 while ((ch != ESCAPE) && !success)
5497 bool move_fast = FALSE;
5499 move_cursor_relative(y, x);
5511 if (x == px && y == py) ch = 0;
5514 else success = TRUE;
5518 /* Look up the direction */
5519 d = get_keymap_dir(ch);
5521 /* XTRA HACK MOVEFAST */
5522 if (isupper(ch)) move_fast = TRUE;
5524 /* Handle "direction" */
5530 /* XTRA HACK MOVEFAST */
5540 /* Do not move horizontally if unnecessary */
5541 if (((x < panel_col_min + wid / 2) && (dx > 0)) ||
5542 ((x > panel_col_min + wid / 2) && (dx < 0)))
5547 /* Do not move vertically if unnecessary */
5548 if (((y < panel_row_min + hgt / 2) && (dy > 0)) ||
5549 ((y > panel_row_min + hgt / 2) && (dy < 0)))
5554 /* Apply the motion */
5555 if ((y >= panel_row_min + hgt) || (y < panel_row_min) ||
5556 (x >= panel_col_min + wid) || (x < panel_col_min))
5558 /* if (change_panel(dy, dx)) target_set_prepare(mode); */
5559 change_panel(dy, dx);
5562 /* Slide into legality */
5563 if (x >= cur_wid-1) x = cur_wid - 2;
5564 else if (x <= 0) x = 1;
5566 /* Slide into legality */
5567 if (y >= cur_hgt-1) y = cur_hgt- 2;
5568 else if (y <= 0) y = 1;
5575 /* Clear the top line */
5578 /* Recenter the map around the player */
5582 p_ptr->update |= (PU_MONSTERS);
5585 p_ptr->redraw |= (PR_MAP);
5588 p_ptr->window |= (PW_OVERHEAD);
5599 bool get_hack_dir(int *dp)
5609 /* Global direction */
5612 /* (No auto-targeting) */
5614 /* Ask until satisfied */
5617 /* Choose a prompt */
5621 p = "Êý¸þ ('*'¤Ç¥¿¡¼¥²¥Ã¥ÈÁªÂò, ESC¤ÇÃæÃÇ)? ";
5623 p = "Direction ('*' to choose a target, Escape to cancel)? ";
5630 p = "Êý¸þ ('5'¤Ç¥¿¡¼¥²¥Ã¥È¤Ø, '*'¤Ç¥¿¡¼¥²¥Ã¥ÈºÆÁªÂò, ESC¤ÇÃæÃÇ)? ";
5632 p = "Direction ('5' for target, '*' to re-target, Escape to cancel)? ";
5637 /* Get a command (or Cancel) */
5638 if (!get_com(p, &command, TRUE)) break;
5642 if (command == '\r') command = 't';
5645 /* Convert various keys to "standard" keys */
5648 /* Use current target */
5659 /* Set new target */
5664 if (target_set(TARGET_KILL)) dir = 5;
5670 /* Look up the direction */
5671 dir = get_keymap_dir(command);
5677 /* Verify requested targets */
5678 if ((dir == 5) && !target_okay()) dir = 0;
5685 if (!dir) return (FALSE);
5687 /* Save the direction */
5690 /* Check for confusion */
5691 if (p_ptr->confused)
5694 /* Random direction */
5695 dir = ddd[randint0(8)];
5698 /* Notice confusion */
5699 if (command_dir != dir)
5703 msg_print("¤¢¤Ê¤¿¤Ïº®Í𤷤Ƥ¤¤ë¡£");
5705 msg_print("You are confused.");
5710 /* Save direction */
5713 /* A "valid" direction was entered */
5719 * ¥¨¥Í¥ë¥®¡¼¤ÎÁý²ÃÎÌ10d5¤ò®¤¯·×»»¤¹¤ë¤¿¤á¤Î´Ø¿ô
5722 #define Go_no_JuuJou 5*5*5*5*5*5*5*5*5*5
5724 s16b gain_energy(void)
5727 s32b energy_result = 10;
5730 tmp = randint0(Go_no_JuuJou);
5732 for (i = 0; i < 9; i ++){
5733 energy_result += tmp % 5;
5737 return (s16b)(energy_result + tmp);
5744 s16b bow_energy(int sval)
5748 /* Analyze the launcher */
5751 /* Sling and ammo */
5758 /* Short Bow and Arrow */
5765 /* Long Bow and Arrow */
5772 /* Bow of irresponsiblity and Arrow */
5779 /* Light Crossbow and Bolt */
5786 /* Heavy Crossbow and Bolt */
5801 int bow_tmul(int sval)
5805 /* Analyze the launcher */
5808 /* Sling and ammo */
5815 /* Short Bow and Arrow */
5822 /* Long Bow and Arrow */
5829 /* Bow of irresponsiblity and Arrow */
5836 /* Light Crossbow and Bolt */
5843 /* Heavy Crossbow and Bolt */
5855 * Return alignment title
5857 cptr your_alignment(void)
5860 if (p_ptr->align > 150) return "ÂçÁ±";
5861 else if (p_ptr->align > 50) return "ÃæÁ±";
5862 else if (p_ptr->align > 10) return "¾®Á±";
5863 else if (p_ptr->align > -11) return "ÃæΩ";
5864 else if (p_ptr->align > -51) return "¾®°";
5865 else if (p_ptr->align > -151) return "Ãæ°";
5868 if (p_ptr->align > 150) return "Lawful";
5869 else if (p_ptr->align > 50) return "Good";
5870 else if (p_ptr->align > 10) return "Neutral Good";
5871 else if (p_ptr->align > -11) return "Neutral";
5872 else if (p_ptr->align > -51) return "Neutral Evil";
5873 else if (p_ptr->align > -151) return "Evil";
5874 else return "Chaotic";