1 /* NetHack 3.6 mcastu.c $NHDT-Date: 1436753517 2015/07/13 02:11:57 $ $NHDT-Branch: master $:$NHDT-Revision: 1.44 $ */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /*-Copyright (c) Robert Patrick Rankin, 2011. */
4 /* NetHack may be freely redistributed. See license for details. */
6 /* JNetHack Copyright */
7 /* (c) Issei Numata, Naoki Hamada, Shigehiro Miyashita, 1994-2000 */
8 /* For 3.4-, Copyright (c) SHIRAKATA Kentaro, 2002-2018 */
9 /* JNetHack may be freely redistributed. See license for details. */
13 /* monster mage spells */
14 enum mcast_mage_spells {
29 /* monster cleric spells */
30 enum mcast_cleric_spells {
43 STATIC_DCL void FDECL(cursetxt, (struct monst *, BOOLEAN_P));
44 STATIC_DCL int FDECL(choose_magic_spell, (int));
45 STATIC_DCL int FDECL(choose_clerical_spell, (int));
46 STATIC_DCL void FDECL(cast_wizard_spell, (struct monst *, int, int));
47 STATIC_DCL void FDECL(cast_cleric_spell, (struct monst *, int, int));
48 STATIC_DCL boolean FDECL(is_undirected_spell, (unsigned int, int));
50 FDECL(spell_would_be_useless, (struct monst *, unsigned int, int));
52 extern const char *const flash_types[]; /* from zap.c */
54 /* feedback when frustrated monster couldn't cast a spell */
57 cursetxt(mtmp, undirected)
61 if (canseemon(mtmp) && couldsee(mtmp->mx, mtmp->my)) {
62 const char *point_msg; /* spellcasting monsters are impolite */
66 point_msg = "all around, then curses";
68 point_msg = "
\82 \82½
\82è
\88ê
\96Ê
\82ð";
69 else if ((Invis && !perceives(mtmp->data)
70 && (mtmp->mux != u.ux || mtmp->muy != u.uy))
71 || is_obj_mappear(&youmonst, STRANGE_OBJECT)
74 point_msg = "and curses in your general direction";
76 point_msg = "
\82 \82È
\82½
\82Ì
\82¢
\82é
\82 \82½
\82è
\82ð";
77 else if (Displaced && (mtmp->mux != u.ux || mtmp->muy != u.uy))
79 point_msg = "and curses at your displaced image";
81 point_msg = "
\82 \82È
\82½
\82Ì
\8c¶
\89e
\82ð";
84 point_msg = "at you, then curses";
86 point_msg = "
\82 \82È
\82½
\82ð";
89 pline("%s points %s.", Monnam(mtmp), point_msg);
91 pline("%s
\82Í%s
\8ew
\8d·
\82µ
\81C
\8eô
\82¢
\82ð
\82©
\82¯
\82½
\81D", Monnam(mtmp), point_msg);
92 } else if ((!(moves % 4) || !rn2(4))) {
95 Norep("You hear a mumbled curse.");
97 Norep("
\8eô
\82¢
\82Ì
\8c¾
\97t
\82ð
\82Â
\82Ô
\82â
\82
\90º
\82ð
\95·
\82¢
\82½
\81D");
101 /* convert a level based random selection into a specific mage spell;
102 inappropriate choices will be screened out by spell_would_be_useless() */
104 choose_magic_spell(spellval)
107 /* for 3.4.3 and earlier, val greater than 22 selected the default spell
109 while (spellval > 24 && rn2(25))
110 spellval = rn2(spellval);
115 if (Antimagic || Hallucination)
121 return MGC_DEATH_TOUCH;
124 return MGC_CLONE_WIZ;
128 return MGC_SUMMON_MONS;
131 return MGC_AGGRAVATION;
135 return MGC_CURSE_ITEMS;
138 return MGC_DESTRY_ARMR;
141 return MGC_WEAKEN_YOU;
144 return MGC_DISAPPEAR;
148 return MGC_HASTE_SELF;
150 return MGC_CURE_SELF;
157 /* convert a level based random selection into a specific cleric spell */
159 choose_clerical_spell(spellnum)
162 /* for 3.4.3 and earlier, num greater than 13 selected the default spell
164 while (spellnum > 15 && rn2(16))
165 spellnum = rn2(spellnum);
171 return CLC_OPEN_WOUNDS;
176 return CLC_FIRE_PILLAR;
178 return CLC_LIGHTNING;
181 return CLC_CURSE_ITEMS;
186 return CLC_BLIND_YOU;
192 return CLC_CONFUSE_YOU;
194 return CLC_CURE_SELF;
197 return CLC_OPEN_WOUNDS;
202 * 1: successful spell
203 * 0: unsuccessful spell
206 castmu(mtmp, mattk, thinks_it_foundyou, foundyou)
207 register struct monst *mtmp;
208 register struct attack *mattk;
209 boolean thinks_it_foundyou;
212 int dmg, ml = mtmp->m_lev;
217 * -- monster is attacking you. Search for a useful spell.
218 * -- monster thinks it's attacking you. Search for a useful spell,
219 * without checking for undirected. If the spell found is directed,
220 * it fails with cursetxt() and loss of mspec_used.
221 * -- monster isn't trying to attack. Select a spell once. Don't keep
222 * searching; if that spell is not useful (or if it's directed),
223 * return and do something else.
224 * Since most spells are directed, this means that a monster that isn't
225 * attacking casts spells only a small portion of the time that an
226 * attacking monster does.
228 if ((mattk->adtyp == AD_SPEL || mattk->adtyp == AD_CLRC) && ml) {
233 if (mattk->adtyp == AD_SPEL)
234 spellnum = choose_magic_spell(spellnum);
236 spellnum = choose_clerical_spell(spellnum);
237 /* not trying to attack? don't allow directed spells */
238 if (!thinks_it_foundyou) {
239 if (!is_undirected_spell(mattk->adtyp, spellnum)
240 || spell_would_be_useless(mtmp, mattk->adtyp, spellnum)) {
243 "spellcasting monster found you and doesn't know it?");
249 && spell_would_be_useless(mtmp, mattk->adtyp, spellnum));
254 /* monster unable to cast spells? */
255 if (mtmp->mcan || mtmp->mspec_used || !ml) {
256 cursetxt(mtmp, is_undirected_spell(mattk->adtyp, spellnum));
260 if (mattk->adtyp == AD_SPEL || mattk->adtyp == AD_CLRC) {
261 mtmp->mspec_used = 10 - mtmp->m_lev;
262 if (mtmp->mspec_used < 2)
263 mtmp->mspec_used = 2;
266 /* monster can cast spells, but is casting a directed spell at the
267 wrong place? If so, give a message, and return. Do this *after*
268 penalizing mspec_used. */
269 if (!foundyou && thinks_it_foundyou
270 && !is_undirected_spell(mattk->adtyp, spellnum)) {
272 pline("%s casts a spell at %s!",
273 canseemon(mtmp) ? Monnam(mtmp) : "Something",
274 levl[mtmp->mux][mtmp->muy].typ == WATER ? "empty water"
277 pline("%s
\82Í
\89½
\82à
\82È
\82¢%s
\82É
\96\82\96@
\82ð
\82©
\82¯
\82½
\81I",
278 canseemon(mtmp) ? Monnam(mtmp) : "
\89½
\8eÒ
\82©",
279 levl[mtmp->mux][mtmp->muy].typ == WATER ? "
\90\85\92\86"
286 if (rn2(ml * 10) < (mtmp->mconf ? 100 : 20)) { /* fumbled attack */
287 if (canseemon(mtmp) && !Deaf)
289 pline_The("air crackles around %s.", mon_nam(mtmp));
291 pline("%s
\82Ì
\89ñ
\82è
\82Ì
\8bó
\8bC
\82ª
\83p
\83`
\83p
\83`
\89¹
\82ð
\82½
\82Ä
\82Ä
\82¢
\82é
\81D", mon_nam(mtmp));
294 if (canspotmon(mtmp) || !is_undirected_spell(mattk->adtyp, spellnum)) {
296 pline("%s casts a spell%s!",
297 canspotmon(mtmp) ? Monnam(mtmp) : "Something",
298 is_undirected_spell(mattk->adtyp, spellnum)
300 : (Invisible && !perceives(mtmp->data)
301 && (mtmp->mux != u.ux || mtmp->muy != u.uy))
302 ? " at a spot near you"
304 && (mtmp->mux != u.ux || mtmp->muy != u.uy))
305 ? " at your displaced image"
308 const char *who = (canspotmon(mtmp) ? Monnam(mtmp) : "
\89½
\8eÒ
\82©");
309 if(is_undirected_spell(mattk->adtyp, spellnum)){
310 pline("%s
\82Í
\8eô
\95¶
\82ð
\8f¥
\82¦
\82½
\81I", who);
312 pline("%s
\82Í
\82 \82È
\82½%s
\82É
\96\82\96@
\82ð
\82©
\82¯
\82½
\81I",
314 (Invisible && !perceives(mtmp->data) &&
315 (mtmp->mux != u.ux || mtmp->muy != u.uy)) ?
316 "
\82Ì
\82·
\82®
\82»
\82Î" :
317 (Displaced && (mtmp->mux != u.ux || mtmp->muy != u.uy)) ?
325 * As these are spells, the damage is related to the level
326 * of the monster casting the spell.
330 if (mattk->adtyp != AD_SPEL && mattk->adtyp != AD_CLRC) {
332 "%s casting non-hand-to-hand version of hand-to-hand spell %d?",
333 Monnam(mtmp), mattk->adtyp);
336 } else if (mattk->damd)
337 dmg = d((int) ((ml / 2) + mattk->damn), (int) mattk->damd);
339 dmg = d((int) ((ml / 2) + 1), 6);
340 if (Half_spell_damage)
345 switch (mattk->adtyp) {
348 pline("You're enveloped in flames.");
350 You("
\89\8a\82É
\82Â
\82Â
\82Ü
\82ê
\82½
\81D");
351 if (Fire_resistance) {
352 shieldeff(u.ux, u.uy);
354 pline("But you resist the effects.");
356 pline("
\82µ
\82©
\82µ
\81C
\82 \82È
\82½
\82Í
\89e
\8b¿
\82ð
\8eó
\82¯
\82È
\82¢
\81D");
363 pline("You're covered in frost.");
365 You("
\95X
\82É
\95¢
\82í
\82ê
\82½
\81D");
366 if (Cold_resistance) {
367 shieldeff(u.ux, u.uy);
369 pline("But you resist the effects.");
371 pline("
\82µ
\82©
\82µ
\81C
\82 \82È
\82½
\82Í
\89e
\8b¿
\82ð
\8eó
\82¯
\82È
\82¢
\81D");
377 You("are hit by a shower of missiles!");
379 You("
\96\82\96@
\82Ì
\96î
\82ð
\82
\82ç
\82Á
\82½
\81I");
381 shieldeff(u.ux, u.uy);
383 pline_The("missiles bounce off!");
385 pline("
\96\82\96@
\82Ì
\96î
\82Í
\94½
\8eË
\82µ
\82½
\81I");
388 dmg = d((int) mtmp->m_lev / 2 + 1, 6);
390 case AD_SPEL: /* wizard spell */
391 case AD_CLRC: /* clerical spell */
393 if (mattk->adtyp == AD_SPEL)
394 cast_wizard_spell(mtmp, dmg, spellnum);
396 cast_cleric_spell(mtmp, dmg, spellnum);
397 dmg = 0; /* done by the spell casting functions */
406 /* monster wizard and cleric spellcasting functions */
408 If dmg is zero, then the monster is not casting at you.
409 If the monster is intentionally not casting at you, we have previously
410 called spell_would_be_useless() and spellnum should always be a valid
412 If you modify either of these, be sure to change is_undirected_spell()
413 and spell_would_be_useless().
417 cast_wizard_spell(mtmp, dmg, spellnum)
422 if (dmg == 0 && !is_undirected_spell(AD_SPEL, spellnum)) {
423 impossible("cast directed wizard spell (%d) with dmg=0?", spellnum);
428 case MGC_DEATH_TOUCH:
430 pline("Oh no, %s's using the touch of death!", mhe(mtmp));
432 pline("
\82È
\82ñ
\82Ä
\82±
\82Á
\82½
\82¢
\81C%s
\82Í
\8e\80\82Ì
\90é
\8d\90\82ð
\8eg
\82Á
\82Ä
\82¢
\82é
\81I", mhe(mtmp));
433 if (nonliving(youmonst.data) || is_demon(youmonst.data)) {
435 You("seem no deader than before.");
437 You("
\82±
\82ê
\88È
\8fã
\8e\80\82Ë
\82È
\82¢
\82æ
\82¤
\82¾
\81D");
438 } else if (!Antimagic && rn2(mtmp->m_lev) > 12) {
441 You("have an out of body experience.");
443 You("
\97H
\91Ì
\97£
\92E
\82ð
\91Ì
\8c±
\82µ
\82½
\81D");
445 killer.format = KILLED_BY_AN;
447 Strcpy(killer.name, "touch of death");
449 Strcpy(killer.name, "
\8e\80\82Ì
\90é
\8d\90\82Å");
454 shieldeff(u.ux, u.uy);
456 pline("Lucky for you, it didn't work!");
458 pline("
\89^
\82Ì
\82æ
\82¢
\82±
\82Æ
\82É
\82È
\82ñ
\82Æ
\82à
\82È
\82©
\82Á
\82½
\81I");
463 if (mtmp->iswiz && context.no_of_wizards == 1) {
465 pline("Double Trouble...");
467 pline("
\93ñ
\8fd
\8bê
\82¾
\81D
\81D
\81D");
471 impossible("bad wizard cloning?");
473 case MGC_SUMMON_MONS: {
476 count = nasty(mtmp); /* summon something nasty */
479 verbalize("Destroy the thief, my pet%s!", plur(count));
481 verbalize("
\93\90\91¯
\82ð
\8eE
\82¹
\81I
\89ä
\82ª
\89º
\96l
\82æ
\81I");
484 const char *mappear =
485 (count == 1) ? "A monster appears" : "Monsters appear";
488 /* messages not quite right if plural monsters created but
489 only a single monster is seen */
490 if (Invisible && !perceives(mtmp->data)
491 && (mtmp->mux != u.ux || mtmp->muy != u.uy))
493 pline("%s around a spot near you!", mappear);
495 pline("
\89ö
\95¨
\82ª
\82 \82È
\82½
\82Ì
\82·
\82®
\82»
\82Î
\82É
\8c»
\82ê
\82½
\81I");
497 else if (Displaced && (mtmp->mux != u.ux || mtmp->muy != u.uy))
499 pline("%s around your displaced image!", mappear);
501 pline("
\89ö
\95¨
\82ª
\82 \82È
\82½
\82Ì
\8c¶
\89e
\82Ì
\82·
\82®
\82»
\82Î
\82É
\8c»
\82ê
\82½
\81I");
505 pline("%s from nowhere!", mappear);
507 pline("
\89ö
\95¨
\82ª
\82Ç
\82±
\82©
\82ç
\82Æ
\82à
\82È
\82
\8c»
\82ê
\82½
\81I");
513 case MGC_AGGRAVATION:
515 You_feel("that monsters are aware of your presence.");
517 You_feel("
\89ö
\95¨
\82½
\82¿
\82ª
\82 \82È
\82½
\82Ì
\91¶
\8dÝ
\82É
\8bC
\95t
\82¢
\82½
\82æ
\82¤
\82È
\8bC
\82ª
\82µ
\82½
\81D");
521 case MGC_CURSE_ITEMS:
523 You_feel("as if you need some help.");
525 You_feel("
\8f\95\82¯
\82ª
\95K
\97v
\82È
\8bC
\82ª
\82µ
\82½
\81D");
529 case MGC_DESTRY_ARMR:
531 shieldeff(u.ux, u.uy);
533 pline("A field of force surrounds you!");
535 pline("
\95s
\8ev
\8bc
\82È
\97Í
\82ª
\82 \82È
\82½
\82ð
\82Æ
\82è
\82Ü
\82¢
\82½
\81I");
536 } else if (!destroy_arm(some_armor(&youmonst))) {
538 Your("skin itches.");
540 You("
\83\80\83Y
\83\80\83Y
\82µ
\82½
\81D");
544 case MGC_WEAKEN_YOU: /* drain strength */
546 shieldeff(u.ux, u.uy);
548 You_feel("momentarily weakened.");
550 You_feel("
\88ê
\8fu
\8eã
\82
\82È
\82Á
\82½
\82æ
\82¤
\82È
\8bC
\82ª
\82µ
\82½
\81D");
553 You("suddenly feel weaker!");
555 You("
\93Ë
\91R
\8eã
\82
\82È
\82Á
\82½
\82æ
\82¤
\82È
\8bC
\82ª
\82µ
\82½
\81D");
556 dmg = mtmp->m_lev - 6;
557 if (Half_spell_damage)
561 done_in_by(mtmp, DIED);
565 case MGC_DISAPPEAR: /* makes self invisible */
566 if (!mtmp->minvis && !mtmp->invis_blkd) {
569 pline("%s suddenly %s!", Monnam(mtmp),
570 !See_invisible ? "disappears" : "becomes transparent");
572 pline("%s
\82Í
\93Ë
\91R%s
\81I", Monnam(mtmp),
573 !See_invisible ? "
\8fÁ
\82¦
\82½" : "
\93§
\96¾
\82É
\82È
\82Á
\82½");
575 mon_set_minvis(mtmp);
576 if (cansee(mtmp->mx, mtmp->my) && !canspotmon(mtmp))
577 map_invisible(mtmp->mx, mtmp->my);
580 impossible("no reason for monster to cast disappear spell?");
583 if (Antimagic || Free_action) {
584 shieldeff(u.ux, u.uy);
587 You_feel("momentarily disoriented.");
589 You("
\88ê
\8fu
\95û
\8cü
\8a´
\8ao
\82ð
\8e¸
\82Á
\82½
\81D");
590 make_stunned(1L, FALSE);
593 You(Stunned ? "struggle to keep your balance." : "reel...");
595 You(Stunned ? "
\83o
\83\89\83\93\83X
\82ð
\8eæ
\82ë
\82¤
\82Æ
\82à
\82ª
\82¢
\82½
\81D" : "
\82æ
\82ë
\82ß
\82¢
\82½
\81D
\81D
\81D");
596 dmg = d(ACURR(A_DEX) < 12 ? 6 : 4, 4);
597 if (Half_spell_damage)
599 make_stunned((HStun & TIMEOUT) + (long) dmg, FALSE);
604 mon_adjust_speed(mtmp, 1, (struct obj *) 0);
608 if (mtmp->mhp < mtmp->mhpmax) {
611 pline("%s looks better.", Monnam(mtmp));
613 pline("%s
\82Í
\8bC
\95ª
\82ª
\82æ
\82
\82È
\82Á
\82½
\82æ
\82¤
\82¾
\81D", Monnam(mtmp));
614 /* note: player healing does 6d4; this used to do 1d8 */
615 if ((mtmp->mhp += d(3, 6)) > mtmp->mhpmax)
616 mtmp->mhp = mtmp->mhpmax;
621 /* prior to 3.4.0 Antimagic was setting the damage to 1--this
622 made the spell virtually harmless to players with magic res. */
624 shieldeff(u.ux, u.uy);
629 You("get a slight %sache.", body_part(HEAD));
631 You("
\82¿
\82å
\82Á
\82Æ%s
\92É
\82ª
\82µ
\82½
\81D",body_part(HEAD));
634 Your("brain is on fire!");
636 You("
\93{
\82è
\82É
\82Â
\82Â
\82Ü
\82ê
\82½
\81I");
639 Your("%s suddenly aches painfully!", body_part(HEAD));
641 You("
\93Ë
\91R%s
\92É
\82É
\82¨
\82»
\82í
\82ê
\82½
\81I", body_part(HEAD));
644 Your("%s suddenly aches very painfully!", body_part(HEAD));
646 You("
\93Ë
\91R
\8c\83\82µ
\82¢%s
\92É
\82É
\82¨
\82»
\82í
\82ê
\82½
\81I", body_part(HEAD));
649 impossible("mcastu: invalid magic spell (%d)", spellnum);
660 cast_cleric_spell(mtmp, dmg, spellnum)
665 if (dmg == 0 && !is_undirected_spell(AD_CLRC, spellnum)) {
666 impossible("cast directed cleric spell (%d) with dmg=0?", spellnum);
672 /* this is physical damage (force not heat),
673 * not magical damage or fire damage
676 pline("A sudden geyser slams into you from nowhere!");
678 pline("
\91÷
\97¬
\82ª
\82Ç
\82±
\82©
\82ç
\82Æ
\82à
\82È
\82
\8c»
\82ê
\82Ä
\82 \82È
\82½
\82ð
\91Å
\82¿
\82Â
\82¯
\82½
\81I");
680 if (Half_physical_damage)
683 case CLC_FIRE_PILLAR:
685 pline("A pillar of fire strikes all around you!");
687 pline("
\82 \82È
\82½
\82Ì
\8eü
\82è
\82É
\89Î
\92\8c\82ª
\97§
\82Á
\82½
\81I");
688 if (Fire_resistance) {
689 shieldeff(u.ux, u.uy);
693 if (Half_spell_damage)
696 (void) burnarmor(&youmonst);
697 destroy_item(SCROLL_CLASS, AD_FIRE);
698 destroy_item(POTION_CLASS, AD_FIRE);
699 destroy_item(SPBOOK_CLASS, AD_FIRE);
700 (void) burn_floor_objects(u.ux, u.uy, TRUE, FALSE);
702 case CLC_LIGHTNING: {
706 pline("A bolt of lightning strikes down at you from above!");
708 pline("
\82 \82È
\82½
\82Ì
\90^
\8fã
\82©
\82ç
\88î
\8dÈ
\82ª
\8d~
\82è
\92\8d\82¢
\82¾
\81I");
710 reflects = ureflects("It bounces off your %s%s.", "");
712 reflects = ureflects("
\82»
\82ê
\82Í
\82 \82È
\82½
\82Ì%s%s
\82Å
\92µ
\82Ë
\95Ô
\82Á
\82½
\81D", "");
713 if (reflects || Shock_resistance) {
714 shieldeff(u.ux, u.uy);
720 if (Half_spell_damage)
722 destroy_item(WAND_CLASS, AD_ELEC);
723 destroy_item(RING_CLASS, AD_ELEC);
724 (void) flashburn((long) rnd(100));
727 case CLC_CURSE_ITEMS:
729 You_feel("as if you need some help.");
731 You_feel("
\8f\95\82¯
\82ª
\95K
\97v
\82È
\8bC
\82ª
\82µ
\82½
\81D");
736 /* Try for insects, and if there are none
737 left, go for (sticks to) snakes. -3. */
738 struct permonst *pm = mkclass(S_ANT, 0);
739 struct monst *mtmp2 = (struct monst *) 0;
740 char let = (pm ? S_ANT : S_SNAKE);
741 boolean success = FALSE, seecaster;
742 int i, quan, oldseen, newseen;
746 oldseen = monster_census(TRUE);
747 quan = (mtmp->m_lev < 2) ? 1 : rnd((int) mtmp->m_lev / 2);
750 for (i = 0; i <= quan; i++) {
751 if (!enexto(&bypos, mtmp->mux, mtmp->muy, mtmp->data))
753 if ((pm = mkclass(let, 0)) != 0
754 && (mtmp2 = makemon(pm, bypos.x, bypos.y, MM_ANGRY)) != 0) {
756 mtmp2->msleeping = mtmp2->mpeaceful = mtmp2->mtame = 0;
760 newseen = monster_census(TRUE);
762 /* not canspotmon(), which includes unseen things sensed via warning
764 seecaster = canseemon(mtmp) || tp_sensemon(mtmp) || Detect_monsters;
768 char *arg; /* [not const: upstart(N==1 ? an() : makeplural())] */
770 const char *what = (let == S_SNAKE) ? "snake" : "insect";
772 const char *what = (let == S_SNAKE) ? "
\83w
\83r" : "
\92\8e";
774 if (newseen <= oldseen || Unaware) {
775 /* unseen caster fails or summons unseen critters,
776 or unconscious hero ("You dream that you hear...") */
778 You_hear("someone summoning %s.", makeplural(what));
780 You_hear("
\92N
\82©
\82ª%s
\82ð
\8f¢
\8a«
\82µ
\82Ä
\82¢
\82é
\82Ì
\82ð
\95·
\82¢
\82½
\81D", what);
782 /* unseen caster summoned seen critter(s) */
783 arg = (newseen == oldseen + 1) ? an(what) : makeplural(what);
786 You_hear("someone summoning something, and %s %s.", arg,
787 vtense(arg, "appear"));
789 You_hear("
\92N
\82©
\82ª
\89½
\82©
\82ð
\8f¢
\8a«
\82·
\82é
\82Ì
\82ð
\95·
\82¢
\82½
\81C
\82»
\82µ
\82Ä%s
\82ª
\8c»
\82ê
\82½
\81D",
794 pline("%s %s.", upstart(arg), vtense(arg, "appear"));
796 pline("%s
\82ª
\8c»
\82ê
\82½
\81D", arg);
799 /* seen caster, possibly producing unseen--or just one--critters;
800 hero is told what the caster is doing and doesn't necessarily
801 observe complete accuracy of that caster's results (in other
802 words, no need to fuss with visibility or singularization;
803 player is told what's happening even if hero is unconscious) */
806 fmt = "%s casts at a clump of sticks, but nothing happens.";
808 fmt = "%s
\82Í
\96_
\90Ø
\82ê
\82É
\96\82\96@
\82ð
\82©
\82¯
\82½
\82ª
\81C
\82È
\82É
\82à
\82¨
\82±
\82ç
\82È
\82©
\82Á
\82½
\81D";
809 else if (let == S_SNAKE)
811 fmt = "%s transforms a clump of sticks into snakes!";
813 fmt = "%s
\82Í
\96_
\90Ø
\82ê
\82ð
\83w
\83r
\82É
\95Ï
\82¦
\82½
\81I";
814 else if (Invisible && !perceives(mtmp->data)
815 && (mtmp->mux != u.ux || mtmp->muy != u.uy))
817 fmt = "%s summons insects around a spot near you!";
819 fmt = "%s
\82Í
\92\8e\82ð
\82 \82È
\82½
\82Ì
\82·
\82®
\82»
\82Î
\82É
\8f¢
\8a«
\82µ
\82½
\81I";
820 else if (Displaced && (mtmp->mux != u.ux || mtmp->muy != u.uy))
822 fmt = "%s summons insects around your displaced image!";
824 fmt = "%s
\82Í
\92\8e\82ð
\82 \82È
\82½
\82Ì
\8c¶
\89e
\82Ì
\8eü
\82è
\82É
\8f¢
\8a«
\82µ
\82½
\81I";
827 fmt = "%s summons insects!";
829 fmt = "%s
\82Í
\92\8e\82ð
\8f¢
\8a«
\82µ
\82½
\81I";
831 pline(fmt, Monnam(mtmp));
837 /* note: resists_blnd() doesn't apply here */
840 int num_eyes = eyecount(youmonst.data);
841 pline("Scales cover your %s!", (num_eyes == 1)
843 : makeplural(body_part(EYE)));
845 pline("
\97Ø
\82ª
\82 \82È
\82½
\82Ì%s
\82ð
\95¢
\82Á
\82½
\81I", body_part(EYE));
847 make_blinded(Half_spell_damage ? 100L : 200L, FALSE);
849 Your1(vision_clears);
852 impossible("no reason for monster to cast blindness spell?");
855 if (Antimagic || Free_action) {
856 shieldeff(u.ux, u.uy);
859 You("stiffen briefly.");
861 You("
\88ê
\8fu
\8dd
\92¼
\82µ
\82½
\81D");
864 multi_reason = "paralyzed by a monster";
866 multi_reason = "
\89ö
\95¨
\82É
\96\83á
\83\82³
\82¹
\82ç
\82ê
\82½
\8c\84\82É";
870 You("are frozen in place!");
872 You("
\82»
\82Ì
\8fê
\82Å
\93®
\82¯
\82È
\82
\82È
\82Á
\82½
\81I");
873 dmg = 4 + (int) mtmp->m_lev;
874 if (Half_spell_damage)
878 multi_reason = "paralyzed by a monster";
880 multi_reason = "
\89ö
\95¨
\82É
\96\83á
\83\82³
\82¹
\82ç
\82ê
\82½
\8c\84\82É";
885 case CLC_CONFUSE_YOU:
887 shieldeff(u.ux, u.uy);
889 You_feel("momentarily dizzy.");
891 You("
\88ê
\8fu
\82ß
\82Ü
\82¢
\82ª
\82µ
\82½
\81D");
893 boolean oldprop = !!Confusion;
895 dmg = (int) mtmp->m_lev;
896 if (Half_spell_damage)
898 make_confused(HConfusion + dmg, TRUE);
901 You_feel("%s!", oldprop ? "trippier" : "trippy");
903 You("%s
\82Ö
\82ë
\82Ö
\82ë
\82É
\82È
\82Á
\82½
\81I", oldprop ? "
\82à
\82Á
\82Æ" : "");
907 You_feel("%sconfused!", oldprop ? "more " : "");
909 You("%s
\8d¬
\97\90\82µ
\82½
\81I", oldprop ? "
\82à
\82Á
\82Æ" : "");
915 if (mtmp->mhp < mtmp->mhpmax) {
918 pline("%s looks better.", Monnam(mtmp));
920 pline("%s
\82Í
\8bC
\95ª
\82ª
\82æ
\82
\82È
\82Á
\82½
\82æ
\82¤
\82¾
\81D", Monnam(mtmp));
922 /* note: player healing does 6d4; this used to do 1d8 */
923 if ((mtmp->mhp += d(3, 6)) > mtmp->mhpmax)
924 mtmp->mhp = mtmp->mhpmax;
928 case CLC_OPEN_WOUNDS:
930 shieldeff(u.ux, u.uy);
935 Your("skin itches badly for a moment.");
937 Your("
\94ç
\95\86\82Í
\88ê
\8fu
\81C
\83\80\83Y
\83\80\83Y
\82Á
\82Æ
\82µ
\82½
\81D");
940 pline("Wounds appear on your body!");
942 pline("
\8f\9d\82ª
\82 \82È
\82½
\82Ì
\91Ì
\82É
\8fo
\97\88\82½
\81I");
945 pline("Severe wounds appear on your body!");
947 pline("
\82Ð
\82Ç
\82¢
\8f\9d\82ª
\82 \82È
\82½
\82Ì
\91Ì
\82É
\8fo
\97\88\82½
\81I");
950 Your("body is covered with painful wounds!");
952 pline("
\91Ì
\82ª
\8f\9d\82¾
\82ç
\82¯
\82É
\82È
\82Á
\82½
\81I");
955 impossible("mcastu: invalid clerical spell (%d)", spellnum);
966 is_undirected_spell(adtyp, spellnum)
970 if (adtyp == AD_SPEL) {
973 case MGC_SUMMON_MONS:
974 case MGC_AGGRAVATION:
982 } else if (adtyp == AD_CLRC) {
994 /* Some spells are useless under some circumstances. */
997 spell_would_be_useless(mtmp, adtyp, spellnum)
1002 /* Some spells don't require the player to really be there and can be cast
1003 * by the monster when you're invisible, yet still shouldn't be cast when
1004 * the monster doesn't even think you're there.
1005 * This check isn't quite right because it always uses your real position.
1006 * We really want something like "if the monster could see mux, muy".
1008 boolean mcouldseeu = couldsee(mtmp->mx, mtmp->my);
1010 if (adtyp == AD_SPEL) {
1011 /* aggravate monsters, etc. won't be cast by peaceful monsters */
1013 && (spellnum == MGC_AGGRAVATION || spellnum == MGC_SUMMON_MONS
1014 || spellnum == MGC_CLONE_WIZ))
1016 /* haste self when already fast */
1017 if (mtmp->permspeed == MFAST && spellnum == MGC_HASTE_SELF)
1019 /* invisibility when already invisible */
1020 if ((mtmp->minvis || mtmp->invis_blkd) && spellnum == MGC_DISAPPEAR)
1022 /* peaceful monster won't cast invisibility if you can't see
1024 same as when monsters drink potions of invisibility. This doesn't
1025 really make a lot of sense, but lets the player avoid hitting
1026 peaceful monsters by mistake */
1027 if (mtmp->mpeaceful && !See_invisible && spellnum == MGC_DISAPPEAR)
1029 /* healing when already healed */
1030 if (mtmp->mhp == mtmp->mhpmax && spellnum == MGC_CURE_SELF)
1032 /* don't summon monsters if it doesn't think you're around */
1033 if (!mcouldseeu && (spellnum == MGC_SUMMON_MONS
1034 || (!mtmp->iswiz && spellnum == MGC_CLONE_WIZ)))
1036 if ((!mtmp->iswiz || context.no_of_wizards > 1)
1037 && spellnum == MGC_CLONE_WIZ)
1039 /* aggravation (global wakeup) when everyone is already active */
1040 if (spellnum == MGC_AGGRAVATION) {
1041 /* if nothing needs to be awakened then this spell is useless
1042 but caster might not realize that [chance to pick it then
1043 must be very small otherwise caller's many retry attempts
1044 will eventually end up picking it too often] */
1045 if (!has_aggravatables(mtmp))
1046 return rn2(100) ? TRUE : FALSE;
1048 } else if (adtyp == AD_CLRC) {
1049 /* summon insects/sticks to snakes won't be cast by peaceful monsters
1051 if (mtmp->mpeaceful && spellnum == CLC_INSECTS)
1053 /* healing when already healed */
1054 if (mtmp->mhp == mtmp->mhpmax && spellnum == CLC_CURE_SELF)
1056 /* don't summon insects if it doesn't think you're around */
1057 if (!mcouldseeu && spellnum == CLC_INSECTS)
1059 /* blindness spell on blinded player */
1060 if (Blinded && spellnum == CLC_BLIND_YOU)
1066 /* convert 1..10 to 0..9; add 10 for second group (spell casting) */
1067 #define ad_to_typ(k) (10 + (int) k - 1)
1069 /* monster uses spell (ranged) */
1072 register struct monst *mtmp;
1073 register struct attack *mattk;
1075 /* don't print constant stream of curse messages for 'normal'
1076 spellcasting monsters at range */
1077 if (mattk->adtyp > AD_SPC2)
1081 cursetxt(mtmp, FALSE);
1084 if (lined_up(mtmp) && rn2(3)) {
1086 if (mattk->adtyp && (mattk->adtyp < 11)) { /* no cf unsigned >0 */
1087 if (canseemon(mtmp))
1089 pline("%s zaps you with a %s!", Monnam(mtmp),
1090 flash_types[ad_to_typ(mattk->adtyp)]);
1092 pline("%s
\82Í%s
\82ð
\82 \82È
\82½
\82É
\8cü
\82¯
\82Ä
\95ú
\82Á
\82½
\81D", Monnam(mtmp),
1093 flash_types[ad_to_typ(mattk->adtyp)]);
1095 buzz(-ad_to_typ(mattk->adtyp), (int) mattk->damn, mtmp->mx,
1096 mtmp->my, sgn(tbx), sgn(tby));
1098 impossible("Monster spell %d cast", mattk->adtyp - 1);