3 /* Purpose: Monster attacks */
6 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
8 * This software may be copied and distributed for educational, research,
9 * and not for profit purposes provided that this copyright and statement
10 * are included in all such copies. Other copyrights may also apply.
17 * Critical blow. All hits that do 95% of total possible damage,
18 * and which also do at least 20 damage, or, sometimes, N damage.
19 * This is used only to determine "cuts" and "stuns".
21 static int monster_critical(int dice, int sides, int dam)
24 int total = dice * sides;
26 /* Must do at least 95% of perfect */
27 if (dam < total * 19 / 20) return (0);
29 /* Weak blows rarely work */
30 if ((dam < 20) && (randint0(100) >= dam)) return (0);
33 if ((dam >= total) && (dam >= 40)) max++;
38 while (randint0(100) < 2) max++;
42 if (dam > 45) return (6 + max);
43 if (dam > 33) return (5 + max);
44 if (dam > 25) return (4 + max);
45 if (dam > 18) return (3 + max);
46 if (dam > 11) return (2 + max);
55 * Determine if a monster attack against the player succeeds.
56 * Always miss 5% of the time, Always hit 5% of the time.
57 * Otherwise, match monster power against player armor.
59 static int check_hit(int power, int level, int stun)
66 if (stun && one_in_(2)) return FALSE;
68 /* Hack -- Always miss or hit */
69 if (k < 10) return (k < 5);
71 /* Calculate the "attack quality" */
72 i = (power + (level * 3));
75 ac = p_ptr->ac + p_ptr->to_a;
76 if (p_ptr->special_attack & ATTACK_SUIKEN) ac += (p_ptr->lev * 2);
78 /* Power and Level compete against Armor */
79 if ((i > 0) && (randint1(i) > ((ac * 3) / 4))) return (TRUE);
88 * Hack -- possible "insult" messages
90 static cptr desc_insult[] =
93 "¤¬¤¢¤Ê¤¿¤òÉî¿«¤·¤¿¡ª",
94 "¤¬¤¢¤Ê¤¿¤ÎÊì¤òÉî¿«¤·¤¿¡ª",
95 "¤¬¤¢¤Ê¤¿¤ò·ÚÊΤ·¤¿¡ª",
98 "¤¬¤¢¤Ê¤¿¤Î²ó¤ê¤ÇÍ٤ä¿¡ª",
99 "¤¬àÐêø¤Ê¿È¤Ö¤ê¤ò¤·¤¿¡ª",
100 "¤¬¤¢¤Ê¤¿¤ò¤Ü¤ó¤ä¤ê¤È¸«¤¿¡ª¡ª¡ª",
101 "¤¬¤¢¤Ê¤¿¤ò¥Ñ¥é¥µ¥¤¥È¸Æ¤Ð¤ï¤ê¤·¤¿¡ª",
102 "¤¬¤¢¤Ê¤¿¤ò¥µ¥¤¥Ü¡¼¥°°·¤¤¤·¤¿¡ª"
105 "insults your mother!",
106 "gives you the finger!",
109 "dances around you!",
110 "makes obscene gestures!",
112 "calls you a parasite!",
113 "calls you a cyborg!"
121 * Hack -- possible "insult" messages
123 static cptr desc_moan[] =
126 "¤Ï²¿¤«¤òÈᤷ¤ó¤Ç¤¤¤ë¤è¤¦¤À¡£",
127 "¤¬Èà¤Î»ô¤¤¸¤¤ò¸«¤Ê¤«¤Ã¤¿¤«¤È¿Ò¤Í¤Æ¤¤¤ë¡£",
128 "¤¬ÆìÄ¥¤ê¤«¤é½Ð¤Æ¹Ô¤±¤È¸À¤Ã¤Æ¤¤¤ë¡£",
129 "¤Ï¥¥Î¥³¤¬¤É¤¦¤È¤«Ò줤¤Æ¤¤¤ë¡£"
131 "seems sad about something.",
132 "asks if you have seen his dogs.",
133 "tells you to get off his land.",
134 "mumbles something about mushrooms."
141 * Attack the player via physical attacks.
143 bool make_attack_normal(int m_idx)
145 monster_type *m_ptr = &m_list[m_idx];
147 monster_race *r_ptr = &r_info[m_ptr->r_idx];
151 int i, k, tmp, ac, rlev;
158 char o_name[MAX_NLEN];
165 bool touched = FALSE, fear = FALSE, alive = TRUE;
166 bool explode = FALSE;
167 bool do_silly_attack = (one_in_(2) && p_ptr->image);
173 /* Not allowed to attack */
174 if (r_ptr->flags1 & (RF1_NEVER_BLOW)) return (FALSE);
176 if (d_info[dungeon_type].flags1 & DF1_NO_MELEE) return (FALSE);
178 /* ...nor if friendly */
179 if (!is_hostile(m_ptr)) return FALSE;
181 /* Extract the effective monster level */
182 rlev = ((r_ptr->level >= 1) ? r_ptr->level : 1);
185 /* Get the monster name (or "it") */
186 monster_desc(m_name, m_ptr, 0);
188 /* Get the "died from" information (i.e. "a kobold") */
189 monster_desc(ddesc, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
191 if (p_ptr->special_defense & KATA_IAI)
194 msg_print("Áê¼ê¤¬½±¤¤¤«¤«¤ëÁ°¤ËÁÇÁ᤯Éð´ï¤ò¿¶¤ë¤Ã¤¿¡£");
196 msg_format("You took sen, draw and cut in one motion before %s move.", m_name);
198 if (py_attack(m_ptr->fy, m_ptr->fx, HISSATSU_IAI)) return TRUE;
201 if ((p_ptr->special_defense & NINJA_KAWARIMI) && (randint0(55) < (p_ptr->lev*3/5+20)))
207 /* Assume no blink */
210 /* Scan through all four blows */
211 for (ap_cnt = 0; ap_cnt < 4; ap_cnt++)
213 bool visible = FALSE;
214 bool obvious = FALSE;
221 /* Extract the attack infomation */
222 int effect = r_ptr->blow[ap_cnt].effect;
223 int method = r_ptr->blow[ap_cnt].method;
224 int d_dice = r_ptr->blow[ap_cnt].d_dice;
225 int d_side = r_ptr->blow[ap_cnt].d_side;
228 if (!m_ptr->r_idx) break;
230 /* Hack -- no more attacks */
233 if (is_pet(m_ptr) && (r_ptr->flags1 & RF1_UNIQUE) && (method == RBM_EXPLODE))
239 /* Stop if player is dead or gone */
240 if (!p_ptr->playing || p_ptr->is_dead) break;
241 if (distance(py, px, m_ptr->fy, m_ptr->fx) > 1) break;
243 /* Handle "leaving" */
244 if (p_ptr->leaving) break;
246 if (method == RBM_SHOOT) continue;
248 /* Extract visibility (before blink) */
249 if (m_ptr->ml) visible = TRUE;
251 /* Extract the attack "power" */
252 power = mbe_info[effect].power;
255 ac = p_ptr->ac + p_ptr->to_a;
257 /* Monster hits player */
258 if (!effect || check_hit(power, rlev, m_ptr->stunned))
260 /* Always disturbing */
264 /* Hack -- Apply "protection from evil" */
265 if ((p_ptr->protevil > 0) &&
266 (r_ptr->flags3 & RF3_EVIL) &&
267 (p_ptr->lev >= rlev) &&
268 ((randint0(100) + p_ptr->lev) > 50))
270 /* Remember the Evil-ness */
271 if (m_ptr->ml && is_original_ap(m_ptr))
273 r_ptr->r_flags3 |= RF3_EVIL;
279 msg_format("·âÂष¤¿¡£");
281 msg_format("%^s¤Ï·âÂव¤ì¤¿¡£", m_name);
282 abbreviate = 1;/*£²²óÌܰʹߤϾÊά */
284 msg_format("%^s is repelled.", m_name);
288 /* Hack -- Next attack */
293 /* Assume no cut or stun */
294 do_cut = do_stun = 0;
296 /* Describe the attack method */
307 do_cut = do_stun = 1;
318 act = "touches you.";
329 act = "¥Ñ¥ó¥Á¤µ¤ì¤¿¡£";
331 act = "punches you.";
357 act = "¤Ò¤Ã¤«¤«¤ì¤¿¡£";
400 act = "slashes you.";
412 act = "³Ñ¤ÇÆͤ«¤ì¤¿¡£";
426 act = "ÂÎÅö¤¿¤ê¤µ¤ì¤¿¡£";
428 act = "crushes you.";
440 act = "°û¤ß¹þ¤Þ¤ì¤¿¡£";
442 act = "engulfs you.";
454 act = "¤ÏÀÁµá½ñ¤ò¤è¤³¤·¤¿¡£";
456 act = "charges you.";
460 sound(SOUND_BUY); /* Note! This is "charges", not "charges at". */
468 act = "¤¬ÂΤξå¤òÇ礤²ó¤Ã¤¿¡£";
470 act = "crawls on you.";
481 act = "¤è¤À¤ì¤ò¤¿¤é¤µ¤ì¤¿¡£";
483 act = "drools on you.";
493 act = "ÂäòÅǤ«¤ì¤¿¡£";
495 act = "spits on you.";
506 act = "¤ÏÇúȯ¤·¤¿¡£";
518 act = "¤Ë¤é¤Þ¤ì¤¿¡£";
520 act = "gazes at you.";
529 act = "µã¤¶«¤Ð¤ì¤¿¡£";
531 act = "wails at you.";
541 act = "˦»Ò¤òÈô¤Ð¤µ¤ì¤¿¡£";
543 act = "releases spores at you.";
554 act = "¤¬ XXX4 ¤òȯ¼Í¤·¤¿¡£";
556 act = "projects XXX4's at you.";
565 act = "¶â¤ò¤»¤¬¤Þ¤ì¤¿¡£";
567 act = "begs you for money.";
579 act = desc_insult[randint0(m_ptr->r_idx == MON_DEBBY ? 10 : 8)];
589 act = desc_moan[randint0(4)];
599 if (m_ptr->r_idx == MON_JAIAN)
607 act = "¡Ö¢ö¤ª¡Á¤ì¤Ï¥¸¥ã¥¤¥¢¥ó¡Á¡Á¥¬¡Á¥¤À¤¤¤·¤ç¤¦¡Á¡×";
610 act = "¡Ö¢ö¤Æ¡Á¤ó¤«¤à¡Á¤Æ¤¤Î¤ª¡Á¤È¤³¤À¤¼¡Á¡Á¡×";
613 act = "¡Ö¢ö¤Î¡Á¤ÓÂÀ¥¹¥ÍÉפϥᤸ¤ã¤Ê¤¤¤è¡Á¡Á¡×";
616 act = "¡Ö¢ö¤±¡Á¤ó¤«¥¹¥Ý¡Á¥Ä¡Á¤É¤ó¤È¤³¤¤¡Á¡×";
619 act = "¡Ö¢ö¤¦¤¿¡Á¤â¡Á¡Á¤¦¡Á¤Þ¤¤¤¼¡Á¤Þ¤«¤·¤È¤±¡Á¡×";
622 act = "¡Ö¢ö¤Þ¡Á¤Á¤¤¤Á¤Ð¡Á¤ó¤Î¤Ë¡Á¤ó¤¤â¤Î¡Á¡Á¡×";
625 act = "¡Ö¢ö¤Ù¤ó¤¤ç¤¦¤·¤å¤¯¤À¤¤¥á¤¸¤ã¤Ê¤¤¤è¡Á¡Á¡×";
628 act = "¡Ö¢ö¤¤Ï¤ä¤µ¤·¡Á¤¯¤Æ¡Á¤Á¡Á¤«¤é¤â¤Á¡Á¡×";
631 act = "¡Ö¢ö¤«¤ª¡Á¤â¡Á¡Á¥¹¥¿¥¤¥ë¤â¡Á¥Ð¥Ä¥°¥ó¤µ¡Á¡×";
634 act = "¡Ö¢ö¤¬¤Ã¤³¤¦¤¤¡Á¤Á¤Î¡Á¤¢¡Á¤Ð¤ì¤ó¤Ü¤¦¡Á¡Á¡×";
637 act = "¡Ö¢ö¥É¡Á¥é¤â¥É¥é¥ß¤â¥á¤¸¤ã¤Ê¤¤¤è¡Á¡Á¡×";
640 act = "¡Ö¢ö¤è¤¸¤²¤ó¤Ý¤±¤Ã¤È¡Á¤Ê¡Á¤¯¤¿¤Ã¤Æ¡Á¡×";
643 act = "¡Ö¢ö¤¢¤·¡Á¤Î¡Á¡Á¤Ê¤¬¤µ¡Á¤Ï¡Á¤Þ¤±¤Ê¤¤¤¼¡Á¡×";
647 act = "horribly sings 'I AM GIAAAAAN. THE BOOOSS OF THE KIIIIDS.'";
654 act = "¤Ï¢öËͤé¤Ï³Ú¤·¤¤²È²¢ö¤È²Î¤Ã¤Æ¤¤¤ë¡£";
656 act = "¤Ï¢ö¥¢¥¤ ¥é¥Ö ¥æ¡¼¡¢¥æ¡¼ ¥é¥Ö ¥ß¡¼¢ö¤È²Î¤Ã¤Æ¤¤¤ë¡£";
658 act = "sings 'We are a happy family.'";
660 act = "sings 'I love you, you love me.'";
677 act = silly_attacks[randint0(MAX_SILLY_ATTACK)];
681 msg_format("%^s¤Ë%s", m_name, act);
682 else if (abbreviate == 1)
683 msg_format("%s", act);
684 else /* if (abbreviate == -1) */
685 msg_format("%^s%s", m_name, act);
686 abbreviate = 1;/*£²²óÌܰʹߤϾÊά */
688 msg_format("%^s %s%s", m_name, act, do_silly_attack ? " you." : "");
692 /* Hack -- assume all attacks are obvious */
695 /* Roll out the damage */
696 damage = damroll(d_dice, d_side);
699 * Skip the effect when exploding, since the explosion
700 * already causes the effect.
704 /* Apply appropriate damage */
709 /* Hack -- Assume obvious */
712 /* Hack -- No damage */
720 if ((randint1(rlev*2+300) > (ac+200)) || one_in_(13)) {
721 int tmp_damage = damage-(damage*((ac < 150) ? ac : 150)/250);
723 msg_print("Ä˺¨¤Î°ì·â¡ª");
725 msg_print("It was a critical hit!");
728 tmp_damage = MAX(damage, tmp_damage*2);
731 get_damage += take_hit(DAMAGE_ATTACK, tmp_damage, ddesc, -1);
740 /* Hack -- Player armor reduces total damage */
741 damage -= (damage * ((ac < 150) ? ac : 150) / 250);
744 get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
753 /* Take "poison" effect */
754 if (!(p_ptr->resist_pois || IS_OPPOSE_POIS()))
756 if (set_poisoned(p_ptr->poisoned + randint1(rlev) + 5))
762 /* Take some damage */
763 get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
765 /* Learn about the player */
766 update_smart_learn(m_idx, DRS_POIS);
775 /* Allow complete resist */
776 if (!p_ptr->resist_disen)
778 /* Apply disenchantment */
779 if (apply_disenchant(0))
781 /* Hack -- Update AC */
787 /* Take some damage */
788 get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
790 /* Learn about the player */
791 update_smart_learn(m_idx, DRS_DISEN);
798 /* Take some damage */
799 get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
801 if (p_ptr->is_dead) break;
804 for (k = 0; k < 10; k++)
807 i = randint0(INVEN_PACK);
809 /* Obtain the item */
810 o_ptr = &inventory[i];
812 /* Skip non-objects */
813 if (!o_ptr->k_idx) continue;
815 /* Drain charged wands/staffs */
816 if (((o_ptr->tval == TV_STAFF) ||
817 (o_ptr->tval == TV_WAND)) &&
820 /* Calculate healed hitpoints */
821 int heal=rlev * o_ptr->pval;
822 if( o_ptr->tval == TV_STAFF)
823 heal *= o_ptr->number;
825 /* Don't heal more than max hp */
826 heal = MIN(heal, m_ptr->maxhp - m_ptr->hp);
830 msg_print("¥¶¥Ã¥¯¤«¤é¥¨¥Í¥ë¥®¡¼¤¬µÛ¤¤¼è¤é¤ì¤¿¡ª");
832 msg_print("Energy drains from your pack!");
839 /* Heal the monster */
842 /* Redraw (later) if needed */
843 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
844 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
849 /* Combine / Reorder the pack */
850 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
853 p_ptr->window |= (PW_INVEN);
865 /* Take some damage */
866 get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
868 /* Confused monsters cannot steal successfully. -LM-*/
869 if (m_ptr->confused) break;
871 if (p_ptr->is_dead) break;
876 /* Saving throw (unless paralyzed) based on dex and level */
877 if (!p_ptr->paralyzed &&
878 (randint0(100) < (adj_dex_safe[p_ptr->stat_ind[A_DEX]] +
881 /* Saving throw message */
883 msg_print("¤·¤«¤·ÁÇÁ᤯ºâÉÛ¤ò¼é¤Ã¤¿¡ª");
885 msg_print("You quickly protect your money pouch!");
889 /* Occasional blink anyway */
890 if (randint0(3)) blinked = TRUE;
896 gold = (p_ptr->au / 10) + randint1(25);
897 if (gold < 2) gold = 2;
898 if (gold > 5000) gold = (p_ptr->au / 20) + randint1(3000);
899 if (gold > p_ptr->au) gold = p_ptr->au;
904 msg_print("¤·¤«¤·²¿¤âÅð¤Þ¤ì¤Ê¤«¤Ã¤¿¡£");
906 msg_print("Nothing was stolen.");
913 msg_print("ºâÉÛ¤¬·Ú¤¯¤Ê¤Ã¤¿µ¤¤¬¤¹¤ë¡£");
914 msg_format("$%ld ¤Î¤ª¶â¤¬Åð¤Þ¤ì¤¿¡ª", (long)gold);
916 msg_print("Your purse feels lighter.");
917 msg_format("%ld coins were stolen!", (long)gold);
919 chg_virtue(V_SACRIFICE, 1);
924 msg_print("ºâÉÛ¤¬·Ú¤¯¤Ê¤Ã¤¿µ¤¤¬¤¹¤ë¡£");
925 msg_print("¤ª¶â¤¬Á´ÉôÅð¤Þ¤ì¤¿¡ª");
927 msg_print("Your purse feels lighter.");
928 msg_print("All of your coins were stolen!");
931 chg_virtue(V_SACRIFICE, 2);
935 p_ptr->redraw |= (PR_GOLD);
938 p_ptr->window |= (PW_PLAYER);
949 /* Take some damage */
950 get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
952 /* Confused monsters cannot steal successfully. -LM-*/
953 if (m_ptr->confused) break;
955 if (p_ptr->is_dead) break;
957 /* Saving throw (unless paralyzed) based on dex and level */
958 if (!p_ptr->paralyzed &&
959 (randint0(100) < (adj_dex_safe[p_ptr->stat_ind[A_DEX]] +
962 /* Saving throw message */
964 msg_print("¤·¤«¤·¤¢¤ï¤Æ¤Æ¥¶¥Ã¥¯¤ò¼è¤êÊÖ¤·¤¿¡ª");
966 msg_print("You grab hold of your backpack!");
970 /* Occasional "blink" anyway */
981 for (k = 0; k < 10; k++)
986 i = randint0(INVEN_PACK);
988 /* Obtain the item */
989 o_ptr = &inventory[i];
991 /* Skip non-objects */
992 if (!o_ptr->k_idx) continue;
995 if (artifact_p(o_ptr) || o_ptr->art_name) continue;
997 /* Get a description */
998 object_desc(o_name, o_ptr, OD_OMIT_PREFIX);
1002 msg_format("%s(%c)¤ò%sÅð¤Þ¤ì¤¿¡ª",
1003 o_name, index_to_label(i),
1004 ((o_ptr->number > 1) ? "°ì¤Ä" : ""));
1006 msg_format("%sour %s (%c) was stolen!",
1007 ((o_ptr->number > 1) ? "One of y" : "Y"),
1008 o_name, index_to_label(i));
1011 chg_virtue(V_SACRIFICE, 1);
1014 /* Make an object */
1022 /* Get new object */
1023 j_ptr = &o_list[o_idx];
1026 object_copy(j_ptr, o_ptr);
1031 /* Hack -- If a rod or wand, allocate total
1032 * maximum timeouts or charges between those
1033 * stolen and those missed. -LM-
1035 if ((o_ptr->tval == TV_ROD) || (o_ptr->tval == TV_WAND))
1037 j_ptr->pval = o_ptr->pval / o_ptr->number;
1038 o_ptr->pval -= j_ptr->pval;
1044 /* Memorize monster */
1045 j_ptr->held_m_idx = m_idx;
1048 j_ptr->next_o_idx = m_ptr->hold_o_idx;
1051 m_ptr->hold_o_idx = o_idx;
1054 /* Steal the items */
1055 inven_item_increase(i, -1);
1056 inven_item_optimize(i);
1073 /* Take some damage */
1074 get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
1076 if (p_ptr->is_dead) break;
1078 /* Steal some food */
1079 for (k = 0; k < 10; k++)
1081 /* Pick an item from the pack */
1082 i = randint0(INVEN_PACK);
1085 o_ptr = &inventory[i];
1087 /* Skip non-objects */
1088 if (!o_ptr->k_idx) continue;
1090 /* Skip non-food objects */
1091 if ((o_ptr->tval != TV_FOOD) && !((o_ptr->tval == TV_CORPSE) && (o_ptr->sval))) continue;
1093 /* Get a description */
1094 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1098 msg_format("%s(%c)¤ò%s¿©¤Ù¤é¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª",
1099 o_name, index_to_label(i),
1100 ((o_ptr->number > 1) ? "°ì¤Ä" : ""));
1102 msg_format("%sour %s (%c) was eaten!",
1103 ((o_ptr->number > 1) ? "One of y" : "Y"),
1104 o_name, index_to_label(i));
1108 /* Steal the items */
1109 inven_item_increase(i, -1);
1110 inven_item_optimize(i);
1124 /* Access the lite */
1125 o_ptr = &inventory[INVEN_LITE];
1127 /* Take some damage */
1128 get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
1130 if (p_ptr->is_dead) break;
1133 if ((o_ptr->xtra4 > 0) && (!artifact_p(o_ptr)))
1136 o_ptr->xtra4 -= (250 + randint1(250));
1137 if (o_ptr->xtra4 < 1) o_ptr->xtra4 = 1;
1143 msg_print("ÌÀ¤«¤ê¤¬°Å¤¯¤Ê¤Ã¤Æ¤·¤Þ¤Ã¤¿¡£");
1145 msg_print("Your light dims.");
1152 p_ptr->window |= (PW_EQUIP);
1166 msg_print("»À¤òÍá¤Ó¤»¤é¤ì¤¿¡ª");
1168 msg_print("You are covered in acid!");
1172 /* Special damage */
1173 get_damage += acid_dam(damage, ddesc, -1);
1175 /* Hack -- Update AC */
1178 /* Learn about the player */
1179 update_smart_learn(m_idx, DRS_ACID);
1192 msg_print("ÅÅ·â¤òÍá¤Ó¤»¤é¤ì¤¿¡ª");
1194 msg_print("You are struck by electricity!");
1198 /* Special damage */
1199 get_damage += elec_dam(damage, ddesc, -1);
1201 /* Learn about the player */
1202 update_smart_learn(m_idx, DRS_ELEC);
1215 msg_print("Á´¿È¤¬±ê¤ËÊñ¤Þ¤ì¤¿¡ª");
1217 msg_print("You are enveloped in flames!");
1221 /* Special damage */
1222 get_damage += fire_dam(damage, ddesc, -1);
1224 /* Learn about the player */
1225 update_smart_learn(m_idx, DRS_FIRE);
1238 msg_print("Á´¿È¤¬Î䵤¤Çʤ¤ï¤ì¤¿¡ª");
1240 msg_print("You are covered with frost!");
1244 /* Special damage */
1245 get_damage += cold_dam(damage, ddesc, -1);
1247 /* Learn about the player */
1248 update_smart_learn(m_idx, DRS_COLD);
1256 get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
1258 if (p_ptr->is_dead) break;
1260 /* Increase "blind" */
1261 if (!p_ptr->resist_blind)
1263 if (set_blind(p_ptr->blind + 10 + randint1(rlev)))
1266 if(m_ptr->r_idx == MON_DIO) msg_print("¤É¤¦¤À¥Ã¡ª¤³¤Î·ì¤ÎÌÜÄÙ¤·¤Ï¥Ã¡ª");
1274 /* Learn about the player */
1275 update_smart_learn(m_idx, DRS_BLIND);
1284 get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
1286 if (p_ptr->is_dead) break;
1288 /* Increase "confused" */
1289 if (!p_ptr->resist_conf)
1291 if (set_confused(p_ptr->confused + 3 + randint1(rlev)))
1297 /* Learn about the player */
1298 update_smart_learn(m_idx, DRS_CONF);
1306 get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
1308 if (p_ptr->is_dead) break;
1310 /* Increase "afraid" */
1311 if (p_ptr->resist_fear)
1314 msg_print("¤·¤«¤·¶²Éݤ˿¯¤µ¤ì¤Ê¤«¤Ã¤¿¡ª");
1316 msg_print("You stand your ground!");
1321 else if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
1324 msg_print("¤·¤«¤·¶²Éݤ˿¯¤µ¤ì¤Ê¤«¤Ã¤¿¡ª");
1326 msg_print("You stand your ground!");
1333 if (set_afraid(p_ptr->afraid + 3 + randint1(rlev)))
1339 /* Learn about the player */
1340 update_smart_learn(m_idx, DRS_FEAR);
1348 get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
1350 if (p_ptr->is_dead) break;
1352 /* Increase "paralyzed" */
1353 if (p_ptr->free_act)
1356 msg_print("¤·¤«¤·¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª");
1358 msg_print("You are unaffected!");
1363 else if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
1366 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
1368 msg_print("You resist the effects!");
1375 if (!p_ptr->paralyzed)
1377 if (set_paralyzed(3 + randint1(rlev)))
1384 /* Learn about the player */
1385 update_smart_learn(m_idx, DRS_FREE);
1392 /* Damage (physical) */
1393 get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
1395 if (p_ptr->is_dead) break;
1398 if (do_dec_stat(A_STR)) obvious = TRUE;
1405 /* Damage (physical) */
1406 get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
1408 if (p_ptr->is_dead) break;
1411 if (do_dec_stat(A_INT)) obvious = TRUE;
1418 /* Damage (physical) */
1419 get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
1421 if (p_ptr->is_dead) break;
1424 if (do_dec_stat(A_WIS)) obvious = TRUE;
1431 /* Damage (physical) */
1432 get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
1434 if (p_ptr->is_dead) break;
1437 if (do_dec_stat(A_DEX)) obvious = TRUE;
1444 /* Damage (physical) */
1445 get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
1447 if (p_ptr->is_dead) break;
1450 if (do_dec_stat(A_CON)) obvious = TRUE;
1457 /* Damage (physical) */
1458 get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
1460 if (p_ptr->is_dead) break;
1463 if (do_dec_stat(A_CHR)) obvious = TRUE;
1470 /* Damage (physical) */
1471 get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
1473 if (p_ptr->is_dead) break;
1475 /* Damage (stats) */
1476 if (do_dec_stat(A_STR)) obvious = TRUE;
1477 if (do_dec_stat(A_DEX)) obvious = TRUE;
1478 if (do_dec_stat(A_CON)) obvious = TRUE;
1479 if (do_dec_stat(A_INT)) obvious = TRUE;
1480 if (do_dec_stat(A_WIS)) obvious = TRUE;
1481 if (do_dec_stat(A_CHR)) obvious = TRUE;
1491 /* Hack -- Reduce damage based on the player armor class */
1492 damage -= (damage * ((ac < 150) ? ac : 150) / 250);
1495 get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
1497 /* Radius 8 earthquake centered at the monster */
1498 if (damage > 23 || explode)
1500 earthquake(m_ptr->fy, m_ptr->fx, 8);
1508 s32b d = damroll(10, 6) + (p_ptr->exp / 100) * MON_DRAIN_LIFE;
1514 get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
1516 if (p_ptr->is_dead) break;
1518 (void)drain_exp(d, d / 10, 95);
1524 s32b d = damroll(20, 6) + (p_ptr->exp / 100) * MON_DRAIN_LIFE;
1530 get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
1532 if (p_ptr->is_dead) break;
1534 (void)drain_exp(d, d / 10, 90);
1540 s32b d = damroll(40, 6) + (p_ptr->exp / 100) * MON_DRAIN_LIFE;
1546 get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
1548 if (p_ptr->is_dead) break;
1550 (void)drain_exp(d, d / 10, 75);
1556 s32b d = damroll(80, 6) + (p_ptr->exp / 100) * MON_DRAIN_LIFE;
1562 get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
1564 if (p_ptr->is_dead) break;
1566 (void)drain_exp(d, d / 10, 50);
1572 /* Take some damage */
1573 get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
1575 if (p_ptr->is_dead) break;
1577 /* Take "poison" effect */
1578 if (!(p_ptr->resist_pois || IS_OPPOSE_POIS()))
1580 if (set_poisoned(p_ptr->poisoned + randint1(rlev) + 5))
1586 /* Damage CON (10% chance)*/
1587 if ((randint1(100) < 11) && (p_ptr->prace != RACE_ANDROID))
1589 /* 1% chance for perm. damage */
1590 bool perm = one_in_(10);
1591 if (dec_stat(A_CON, randint1(10), perm))
1594 msg_print("ɤ¬¤¢¤Ê¤¿¤ò¿ª¤ó¤Ç¤¤¤ëµ¤¤¬¤¹¤ë¡£");
1596 msg_print("You feel strange sickness.");
1608 if (!p_ptr->resist_time)
1610 switch (randint1(10))
1612 case 1: case 2: case 3: case 4: case 5:
1614 if (p_ptr->prace == RACE_ANDROID) break;
1616 msg_print("¿ÍÀ¸¤¬µÕÌá¤ê¤·¤¿µ¤¤¬¤¹¤ë¡£");
1618 msg_print("You feel life has clocked back.");
1621 lose_exp(100 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
1625 case 6: case 7: case 8: case 9:
1627 int stat = randint0(6);
1632 case A_STR: act = "¶¯¤¯"; break;
1633 case A_INT: act = "ÁïÌÀ¤Ç"; break;
1634 case A_WIS: act = "¸ÌÀ¤Ç"; break;
1635 case A_DEX: act = "´ïÍѤÇ"; break;
1636 case A_CON: act = "·ò¹¯¤Ç"; break;
1637 case A_CHR: act = "Èþ¤·¤¯"; break;
1639 case A_STR: act = "strong"; break;
1640 case A_INT: act = "bright"; break;
1641 case A_WIS: act = "wise"; break;
1642 case A_DEX: act = "agile"; break;
1643 case A_CON: act = "hale"; break;
1644 case A_CHR: act = "beautiful"; break;
1650 msg_format("¤¢¤Ê¤¿¤Ï°ÊÁ°¤Û¤É%s¤Ê¤¯¤Ê¤Ã¤Æ¤·¤Þ¤Ã¤¿...¡£", act);
1652 msg_format("You're not as %s as you used to be...", act);
1656 p_ptr->stat_cur[stat] = (p_ptr->stat_cur[stat] * 3) / 4;
1657 if (p_ptr->stat_cur[stat] < 3) p_ptr->stat_cur[stat] = 3;
1658 p_ptr->update |= (PU_BONUS);
1665 msg_print("¤¢¤Ê¤¿¤Ï°ÊÁ°¤Û¤ÉÎ϶¯¤¯¤Ê¤¯¤Ê¤Ã¤Æ¤·¤Þ¤Ã¤¿...¡£");
1667 msg_print("You're not as powerful as you used to be...");
1671 for (k = 0; k < 6; k++)
1673 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 7) / 8;
1674 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
1676 p_ptr->update |= (PU_BONUS);
1681 get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
1687 s32b d = damroll(60, 6) + (p_ptr->exp / 100) * MON_DRAIN_LIFE;
1694 get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
1696 if (p_ptr->is_dead) break;
1698 resist_drain = !drain_exp(d, d / 10, 50);
1700 /* Heal the attacker? */
1701 if (p_ptr->mimic_form)
1703 if (mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING)
1704 resist_drain = TRUE;
1708 switch (p_ptr->prace)
1717 resist_drain = TRUE;
1722 if ((damage > 5) && !resist_drain)
1724 bool did_heal = FALSE;
1726 if (m_ptr->hp < m_ptr->maxhp) did_heal = TRUE;
1729 m_ptr->hp += damroll(4, damage / 6);
1730 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
1732 /* Redraw (later) if needed */
1733 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1734 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
1736 /* Special message */
1737 if (m_ptr->ml && did_heal)
1740 msg_format("%s¤ÏÂÎÎϤò²óÉü¤·¤¿¤è¤¦¤À¡£", m_name);
1742 msg_format("%^s appears healthier.", m_name);
1758 p_ptr->csp -= damage;
1762 p_ptr->csp_frac = 0;
1765 p_ptr->redraw |= (PR_MANA);
1771 /* Hack -- only one of cut or stun */
1772 if (do_cut && do_stun)
1775 if (randint0(100) < 50)
1792 /* Critical hit (zero if non-critical) */
1793 tmp = monster_critical(d_dice, d_side, damage);
1795 /* Roll for damage */
1798 case 0: k = 0; break;
1799 case 1: k = randint1(5); break;
1800 case 2: k = randint1(5) + 5; break;
1801 case 3: k = randint1(20) + 20; break;
1802 case 4: k = randint1(50) + 50; break;
1803 case 5: k = randint1(100) + 100; break;
1804 case 6: k = 300; break;
1805 default: k = 500; break;
1809 if (k) (void)set_cut(p_ptr->cut + k);
1817 /* Critical hit (zero if non-critical) */
1818 tmp = monster_critical(d_dice, d_side, damage);
1820 /* Roll for damage */
1823 case 0: k = 0; break;
1824 case 1: k = randint1(5); break;
1825 case 2: k = randint1(5) + 10; break;
1826 case 3: k = randint1(10) + 20; break;
1827 case 4: k = randint1(15) + 30; break;
1828 case 5: k = randint1(20) + 40; break;
1829 case 6: k = 80; break;
1830 default: k = 150; break;
1833 /* Apply the stun */
1834 if (k) (void)set_stun(p_ptr->stun + k);
1839 sound(SOUND_EXPLODE);
1841 if (mon_take_hit(m_idx, m_ptr->hp + 1, &fear, NULL))
1850 if (p_ptr->sh_fire && alive && !p_ptr->is_dead)
1852 if (!(r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK))
1854 int dam = damroll(2, 6);
1856 /* Modify the damage */
1857 dam = mon_damage_mod(m_ptr, dam, FALSE);
1860 msg_format("%^s¤ÏÆÍÁ³Ç®¤¯¤Ê¤Ã¤¿¡ª", m_name);
1861 if (mon_take_hit(m_idx, dam, &fear,
1862 "¤Ï³¥¤Î»³¤Ë¤Ê¤Ã¤¿¡£"))
1864 msg_format("%^s is suddenly very hot!", m_name);
1866 if (mon_take_hit(m_idx, dam, &fear,
1867 " turns into a pile of ash."))
1877 if (m_ptr->ml && is_original_ap(m_ptr))
1878 r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK);
1882 if (p_ptr->sh_elec && alive && !p_ptr->is_dead)
1884 if (!(r_ptr->flagsr & RFR_EFF_IM_ELEC_MASK))
1886 int dam = damroll(2, 6);
1888 /* Modify the damage */
1889 dam = mon_damage_mod(m_ptr, dam, FALSE);
1892 msg_format("%^s¤ÏÅÅ·â¤ò¤¯¤é¤Ã¤¿¡ª", m_name);
1893 if (mon_take_hit(m_idx, dam, &fear,
1894 "¤Ïdz¤¨³Ì¤Î»³¤Ë¤Ê¤Ã¤¿¡£"))
1896 msg_format("%^s gets zapped!", m_name);
1898 if (mon_take_hit(m_idx, dam, &fear,
1899 " turns into a pile of cinder."))
1909 if (m_ptr->ml && is_original_ap(m_ptr))
1910 r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_ELEC_MASK);
1914 if (p_ptr->sh_cold && alive && !p_ptr->is_dead)
1916 if (!(r_ptr->flagsr & RFR_EFF_IM_COLD_MASK))
1918 int dam = damroll(2, 6);
1920 /* Modify the damage */
1921 dam = mon_damage_mod(m_ptr, dam, FALSE);
1924 msg_format("%^s¤ÏÎ䵤¤ò¤¯¤é¤Ã¤¿¡ª", m_name);
1925 if (mon_take_hit(m_idx, dam, &fear,
1928 msg_format("%^s is very cold!", m_name);
1930 if (mon_take_hit(m_idx, dam, &fear,
1941 if (m_ptr->ml && is_original_ap(m_ptr))
1942 r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_COLD_MASK);
1947 if (p_ptr->dustrobe && alive && !p_ptr->is_dead)
1949 if (!(r_ptr->flagsr & RFR_EFF_RES_SHAR_MASK))
1951 int dam = damroll(2, 6);
1953 /* Modify the damage */
1954 dam = mon_damage_mod(m_ptr, dam, FALSE);
1957 msg_format("%^s¤Ï¶À¤ÎÇËÊÒ¤ò¤¯¤é¤Ã¤¿¡ª", m_name);
1958 if (mon_take_hit(m_idx, dam, &fear,
1959 "¤Ï¥º¥¿¥º¥¿¤Ë¤Ê¤Ã¤¿¡£"))
1961 msg_format("%^s gets zapped!", m_name);
1963 if (mon_take_hit(m_idx, dam, &fear,
1964 " had torn to pieces."))
1973 if (m_ptr->ml && is_original_ap(m_ptr))
1974 r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_RES_SHAR_MASK);
1977 if (is_mirror_grid(&cave[py][px])) {
1978 teleport_player(10);
1982 if (p_ptr->tim_sh_holy && alive && !p_ptr->is_dead)
1984 if (r_ptr->flags3 & RF3_EVIL)
1986 if (!(r_ptr->flagsr & RFR_RES_ALL))
1988 int dam = damroll(2, 6);
1990 /* Modify the damage */
1991 dam = mon_damage_mod(m_ptr, dam, FALSE);
1994 msg_format("%^s¤ÏÀ»¤Ê¤ë¥ª¡¼¥é¤Ç½ý¤Ä¤¤¤¿¡ª", m_name);
1995 if (mon_take_hit(m_idx, dam, &fear,
1998 msg_format("%^s is injured by holy power!", m_name);
2000 if (mon_take_hit(m_idx, dam, &fear,
2007 if (m_ptr->ml && is_original_ap(m_ptr))
2008 r_ptr->r_flags3 |= RF3_EVIL;
2012 if (m_ptr->ml && is_original_ap(m_ptr))
2013 r_ptr->r_flagsr |= RFR_RES_ALL;
2018 if (p_ptr->tim_sh_touki && alive && !p_ptr->is_dead)
2020 if (!(r_ptr->flagsr & RFR_RES_ALL))
2022 int dam = damroll(2, 6);
2024 /* Modify the damage */
2025 dam = mon_damage_mod(m_ptr, dam, FALSE);
2028 msg_format("%^s¤¬±Ô¤¤Æ®µ¤¤Î¥ª¡¼¥é¤Ç½ý¤Ä¤¤¤¿¡ª", m_name);
2029 if (mon_take_hit(m_idx, dam, &fear,
2032 msg_format("%^s is injured by the Force", m_name);
2034 if (mon_take_hit(m_idx, dam, &fear,
2045 if (m_ptr->ml && is_original_ap(m_ptr))
2046 r_ptr->r_flagsr |= RFR_RES_ALL;
2052 /* Monster missed player */
2055 /* Analyze failed attacks */
2071 /* Visible monsters */
2080 msg_format("%s¤«¤ï¤·¤¿¡£", (p_ptr->special_attack & ATTACK_SUIKEN) ? "´ñ̯¤ÊÆ°¤¤Ç" : "");
2082 msg_format("%s%^s¤Î¹¶·â¤ò¤«¤ï¤·¤¿¡£", (p_ptr->special_attack & ATTACK_SUIKEN) ? "´ñ̯¤ÊÆ°¤¤Ç" : "", m_name);
2083 abbreviate = 1;/*£²²óÌܰʹߤϾÊά */
2085 msg_format("%^s misses you.", m_name);
2096 /* Analyze "visible" monsters only */
2097 if (visible && !do_silly_attack)
2099 /* Count "obvious" attacks (and ones that cause damage) */
2100 if (obvious || damage || (r_ptr->r_blows[ap_cnt] > 10))
2102 /* Count attacks of this type */
2103 if (r_ptr->r_blows[ap_cnt] < MAX_UCHAR)
2105 r_ptr->r_blows[ap_cnt]++;
2110 if (p_ptr->riding && damage)
2113 monster_desc(m_name, &m_list[p_ptr->riding], 0);
2114 if (rakuba((damage > 200) ? 200 : damage, FALSE))
2117 msg_format("%^s¤«¤éÍî¤Á¤Æ¤·¤Þ¤Ã¤¿¡ª", m_name);
2119 msg_format("You have fallen from %s.", m_name);
2123 if (p_ptr->special_defense & NINJA_KAWARIMI)
2130 if (p_ptr->tim_eyeeye && get_damage > 0 && !p_ptr->is_dead)
2133 msg_format("¹¶·â¤¬%s¼«¿È¤ò½ý¤Ä¤±¤¿¡ª", m_name);
2135 char m_name_self[80];
2138 monster_desc(m_name_self, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE);
2140 msg_format("The attack of %s has wounded %s!", m_name, m_name_self);
2142 project(0, 0, m_ptr->fy, m_ptr->fx, get_damage, GF_MISSILE, PROJECT_KILL, -1);
2143 set_tim_eyeeye(p_ptr->tim_eyeeye-5, TRUE);
2147 if ((p_ptr->counter || (p_ptr->special_defense & KATA_MUSOU)) && alive && !p_ptr->is_dead && m_ptr->ml && (p_ptr->csp > 7))
2150 monster_desc(m_name, m_ptr, 0);
2154 msg_format("%^s¤ËÈ¿·â¤·¤¿¡ª", m_name);
2156 msg_format("Your counterattack to %s!", m_name);
2158 py_attack(m_ptr->fy, m_ptr->fx, HISSATSU_COUNTER);
2162 p_ptr->redraw |= (PR_MANA);
2166 if (blinked && alive && !p_ptr->is_dead)
2169 msg_print("Å¥ËÀ¤Ï¾Ð¤Ã¤Æƨ¤²¤¿¡ª");
2171 msg_print("The thief flees laughing!");
2174 teleport_away(m_idx, MAX_SIGHT * 2 + 5, FALSE);
2178 /* Always notice cause of death */
2179 if (p_ptr->is_dead && (r_ptr->r_deaths < MAX_SHORT) && !p_ptr->inside_arena)
2184 if (m_ptr->ml && fear && alive && !p_ptr->is_dead)
2188 msg_format("%^s¤Ï¶²ÉݤÇƨ¤²½Ð¤·¤¿¡ª", m_name);
2190 msg_format("%^s flees in terror!", m_name);
2195 if (p_ptr->special_defense & KATA_IAI)
2197 set_action(ACTION_NONE);
2200 /* Assume we attacked */