3 * @brief モンスター魔法の実装(対モンスター処理) / Monster spells (attack monster)
6 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke\n
7 * This software may be copied and distributed for educational, research,\n
8 * and not for profit purposes provided that this copyright and statement\n
9 * are included in all such copies. Other copyrights may also apply.\n
10 * 2014 Deskull rearranged comment for Doxygen.\n
14 #include "system/angband.h"
15 #include "util/util.h"
16 #include "main/sound-definitions-table.h"
17 #include "pet/pet-util.h"
18 #include "effect/effect-characteristics.h"
19 #include "grid/grid.h"
20 #include "dungeon/quest.h"
21 #include "player/player-move.h"
22 #include "player/player-class.h"
23 #include "monster/monster.h"
24 #include "monster/monster-status.h"
25 #include "mspell/monster-spell.h"
26 #include "spell/spells-teleport.h"
27 #include "spell/spells-type.h"
28 #include "spell/range-calc.h"
29 #include "dungeon/dungeon.h"
30 #include "world/world.h"
31 #include "view/display-main-window.h"
32 #include "mspell/assign-monster-spell.h"
33 #include "spell/spells-hex.h"
36 * @brief モンスターが敵対モンスターにビームを当てること可能かを判定する /
37 * Determine if a beam spell will hit the target.
38 * @param target_ptr プレーヤーへの参照ポインタ
43 * @param m_ptr 使用するモンスターの構造体参照ポインタ
44 * @return ビームが到達可能ならばTRUEを返す
46 static bool direct_beam(player_type *target_ptr, POSITION y1, POSITION x1, POSITION y2, POSITION x2, monster_type *m_ptr)
48 /* Check the projection path */
49 floor_type *floor_ptr = target_ptr->current_floor_ptr;
51 int grid_n = project_path(target_ptr, grid_g, MAX_RANGE, y1, x1, y2, x2, PROJECT_THRU);
53 /* No grid is ever projectable from itself */
54 if (!grid_n) return FALSE;
58 bool is_friend = is_pet(m_ptr);
59 for (int i = 0; i < grid_n; i++)
61 y = GRID_Y(grid_g[i]);
62 x = GRID_X(grid_g[i]);
64 if (y == y2 && x == x2)
66 else if (is_friend && floor_ptr->grid_array[y][x].m_idx > 0 &&
67 !are_enemies(target_ptr, m_ptr, &floor_ptr->m_list[floor_ptr->grid_array[y][x].m_idx]))
69 /* Friends don't shoot friends */
73 if (is_friend && player_bold(target_ptr, y, x))
77 if (!hit2) return FALSE;
83 * @brief モンスターが敵対モンスターに直接ブレスを当てることが可能かを判定する /
84 * Determine if a breath will hit the target.
91 * @param is_friend TRUEならば、プレイヤーを巻き込む時にブレスの判定をFALSEにする。
92 * @return ブレスを直接当てられるならばTRUEを返す
94 static bool breath_direct(player_type *master_ptr, POSITION y1, POSITION x1, POSITION y2, POSITION x2, POSITION rad, EFFECT_ID typ, bool is_friend)
103 case GF_DISINTEGRATE:
111 /* Check the projection path */
113 int grid_n = project_path(master_ptr, grid_g, MAX_RANGE, y1, x1, y2, x2, flg);
115 /* Project along the path */
119 for (i = 0; i < grid_n; ++i)
121 int ny = GRID_Y(grid_g[i]);
122 int nx = GRID_X(grid_g[i]);
124 if (flg & PROJECT_DISI)
126 /* Hack -- Balls explode before reaching walls */
127 if (cave_stop_disintegration(master_ptr->current_floor_ptr, ny, nx)) break;
129 else if (flg & PROJECT_LOS)
131 /* Hack -- Balls explode before reaching walls */
132 if (!cave_los_bold(master_ptr->current_floor_ptr, ny, nx)) break;
136 /* Hack -- Balls explode before reaching walls */
137 if (!cave_have_flag_bold(master_ptr->current_floor_ptr, ny, nx, FF_PROJECT)) break;
140 /* Save the "blast epicenter" */
151 if (flg & PROJECT_DISI)
153 if (in_disintegration_range(master_ptr->current_floor_ptr, y1, x1, y2, x2) && (distance(y1, x1, y2, x2) <= rad)) hit2 = TRUE;
154 if (in_disintegration_range(master_ptr->current_floor_ptr, y1, x1, master_ptr->y, master_ptr->x) && (distance(y1, x1, master_ptr->y, master_ptr->x) <= rad)) hityou = TRUE;
156 else if (flg & PROJECT_LOS)
158 if (los(master_ptr, y1, x1, y2, x2) && (distance(y1, x1, y2, x2) <= rad)) hit2 = TRUE;
159 if (los(master_ptr, y1, x1, master_ptr->y, master_ptr->x) && (distance(y1, x1, master_ptr->y, master_ptr->x) <= rad)) hityou = TRUE;
163 if (projectable(master_ptr, y1, x1, y2, x2) && (distance(y1, x1, y2, x2) <= rad)) hit2 = TRUE;
164 if (projectable(master_ptr, y1, x1, master_ptr->y, master_ptr->x) && (distance(y1, x1, master_ptr->y, master_ptr->x) <= rad)) hityou = TRUE;
170 POSITION gx[1024], gy[1024];
172 POSITION gm_rad = rad;
173 breath_shape(master_ptr, grid_g, grid_n, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, y, x, typ);
175 for (i = 0; i < grids; i++)
179 if ((y == y2) && (x == x2)) hit2 = TRUE;
180 if (player_bold(master_ptr, y, x)) hityou = TRUE;
184 if (!hit2) return FALSE;
185 if (is_friend && hityou) return FALSE;
192 * @brief モンスターが特殊能力の目標地点を決める処理 /
193 * Get the actual center point of ball spells (rad > 1) (originally from TOband)
194 * @param target_ptr プレーヤーへの参照ポインタ
197 * @param ty 目標Y座標を返す参照ポインタ
198 * @param tx 目標X座標を返す参照ポインタ
199 * @param flg 判定のフラグ配列
202 void get_project_point(player_type *target_ptr, POSITION sy, POSITION sx, POSITION *ty, POSITION *tx, BIT_FLAGS flg)
205 int path_n = project_path(target_ptr, path_g, MAX_RANGE, sy, sx, *ty, *tx, flg);
210 /* Project along the path */
211 for (int i = 0; i < path_n; i++)
213 sy = GRID_Y(path_g[i]);
214 sx = GRID_X(path_g[i]);
216 /* Hack -- Balls explode before reaching walls */
217 if (!cave_have_flag_bold(target_ptr->current_floor_ptr, sy, sx, FF_PROJECT)) break;
226 * @brief モンスターが敵モンスターに魔力消去を使うかどうかを返す /
227 * Check should monster cast dispel spell at other monster.
228 * @param target_ptr プレーヤーへの参照ポインタ
229 * @param m_idx 術者のモンスターID
230 * @param t_idx 目標のモンスターID
231 * @return 魔力消去を使うべきならばTRUEを変えす。
233 static bool dispel_check_monster(player_type *target_ptr, MONSTER_IDX m_idx, MONSTER_IDX t_idx)
235 monster_type *t_ptr = &target_ptr->current_floor_ptr->m_list[t_idx];
236 if (MON_INVULNER(t_ptr)) return TRUE;
238 if ((t_ptr->mspeed < 135) && MON_FAST(t_ptr)) return TRUE;
241 if ((t_idx == target_ptr->riding) && dispel_check(target_ptr, m_idx)) return TRUE;
243 /* No need to cast dispel spell */
249 * todo モンスターからモンスターへの呪文なのにplayer_typeが引数になり得るのは間違っている……
250 * @brief モンスターが敵モンスターに特殊能力を使う処理のメインルーチン /
251 * Monster tries to 'cast a spell' (or breath, etc) at another monster.
252 * @param target_ptr プレーヤーへの参照ポインタ
253 * @param m_idx 術者のモンスターID
254 * @return 実際に特殊能力を使った場合TRUEを返す
256 * The player is only disturbed if able to be affected by the spell.
258 bool monst_spell_monst(player_type *target_ptr, MONSTER_IDX m_idx)
260 POSITION y = 0, x = 0;
262 MONSTER_IDX target_idx = 0;
268 byte spell[96], num = 0;
270 GAME_TEXT m_name[160];
271 GAME_TEXT t_name[160];
279 floor_type *floor_ptr = target_ptr->current_floor_ptr;
280 monster_type *m_ptr = &floor_ptr->m_list[m_idx];
281 monster_type *t_ptr = NULL;
283 monster_race *r_ptr = &r_info[m_ptr->r_idx];
285 bool see_m = is_seen(m_ptr);
286 bool maneable = player_has_los_bold(target_ptr, m_ptr->fy, m_ptr->fx);
287 bool pet = is_pet(m_ptr);
289 bool in_no_magic_dungeon = (d_info[target_ptr->dungeon_idx].flags1 & DF1_NO_MAGIC) && floor_ptr->dun_level
290 && (!floor_ptr->inside_quest || is_fixed_quest_idx(floor_ptr->inside_quest));
292 bool can_use_lite_area = FALSE;
295 /* Cannot cast spells when confused */
296 if (MON_CONFUSED(m_ptr)) return FALSE;
298 /* Extract the racial spell flags */
299 BIT_FLAGS f4 = r_ptr->flags4;
300 BIT_FLAGS f5 = r_ptr->a_ability_flags1;
301 BIT_FLAGS f6 = r_ptr->a_ability_flags2;
303 /* Target is given for pet? */
304 if (target_ptr->pet_t_m_idx && pet)
306 target_idx = target_ptr->pet_t_m_idx;
307 t_ptr = &floor_ptr->m_list[target_idx];
309 /* Cancel if not projectable (for now) */
310 if ((m_idx == target_idx) || !projectable(target_ptr, m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx))
316 /* Is there counter attack target? */
317 if (!target_idx && m_ptr->target_y)
319 target_idx = floor_ptr->grid_array[m_ptr->target_y][m_ptr->target_x].m_idx;
323 t_ptr = &floor_ptr->m_list[target_idx];
325 /* Cancel if neither enemy nor a given target */
326 if ((m_idx == target_idx) ||
327 ((target_idx != target_ptr->pet_t_m_idx) && !are_enemies(target_ptr, m_ptr, t_ptr)))
332 /* Allow only summoning etc.. if not projectable */
333 else if (!projectable(target_ptr, m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx))
335 f4 &= (RF4_INDIRECT_MASK);
336 f5 &= (RF5_INDIRECT_MASK);
337 f6 &= (RF6_INDIRECT_MASK);
342 /* Look for enemies normally */
345 bool success = FALSE;
347 if (target_ptr->phase_out)
349 start = randint1(floor_ptr->m_max - 1) + floor_ptr->m_max;
350 if (randint0(2)) plus = -1;
352 else start = floor_ptr->m_max + 1;
354 /* Scan thru all monsters */
355 for (int i = start; ((i < start + floor_ptr->m_max) && (i > start - floor_ptr->m_max)); i += plus)
357 MONSTER_IDX dummy = (i % floor_ptr->m_max);
358 if (!dummy) continue;
361 t_ptr = &floor_ptr->m_list[target_idx];
363 if (!monster_is_valid(t_ptr)) continue;
365 /* Monster must be 'an enemy' */
366 if ((m_idx == target_idx) || !are_enemies(target_ptr, m_ptr, t_ptr)) continue;
368 /* Monster must be projectable */
369 if (!projectable(target_ptr, m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx)) continue;
377 if (!success) return FALSE;
380 /* OK -- we've got a target */
384 /* Forget old counter attack target */
387 /* Remove unimplemented spells */
388 f6 &= ~(RF6_WORLD | RF6_TRAPS | RF6_FORGET);
390 if (f4 & RF4_BR_LITE)
392 if (!los(target_ptr, m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx))
393 f4 &= ~(RF4_BR_LITE);
396 /* Remove unimplemented special moves */
397 if (f6 & RF6_SPECIAL)
399 if ((m_ptr->r_idx != MON_ROLENTO) && (r_ptr->d_char != 'B'))
400 f6 &= ~(RF6_SPECIAL);
403 if (f6 & RF6_DARKNESS)
405 bool vs_ninja = (target_ptr->pclass == CLASS_NINJA) && !is_hostile(t_ptr);
408 !(r_ptr->flags3 & (RF3_UNDEAD | RF3_HURT_LITE)) &&
409 !(r_ptr->flags7 & RF7_DARK_MASK))
410 can_use_lite_area = TRUE;
412 if (!(r_ptr->flags2 & RF2_STUPID))
414 if (d_info[target_ptr->dungeon_idx].flags1 & DF1_DARKNESS) f6 &= ~(RF6_DARKNESS);
415 else if (vs_ninja && !can_use_lite_area) f6 &= ~(RF6_DARKNESS);
419 if (in_no_magic_dungeon && !(r_ptr->flags2 & RF2_STUPID))
421 f4 &= (RF4_NOMAGIC_MASK);
422 f5 &= (RF5_NOMAGIC_MASK);
423 f6 &= (RF6_NOMAGIC_MASK);
426 if (floor_ptr->inside_arena || target_ptr->phase_out)
428 f4 &= ~(RF4_SUMMON_MASK);
429 f5 &= ~(RF5_SUMMON_MASK);
430 f6 &= ~(RF6_SUMMON_MASK | RF6_TELE_LEVEL);
432 if (m_ptr->r_idx == MON_ROLENTO) f6 &= ~(RF6_SPECIAL);
435 if (target_ptr->phase_out && !one_in_(3))
440 if (m_idx == target_ptr->riding)
442 f4 &= ~(RF4_RIDING_MASK);
443 f5 &= ~(RF5_RIDING_MASK);
444 f6 &= ~(RF6_RIDING_MASK);
450 f6 &= ~(RF6_DARKNESS | RF6_TRAPS);
452 if (!(target_ptr->pet_extra_flags & PF_TELEPORT))
454 f6 &= ~(RF6_BLINK | RF6_TPORT | RF6_TELE_TO | RF6_TELE_AWAY | RF6_TELE_LEVEL);
457 if (!(target_ptr->pet_extra_flags & PF_ATTACK_SPELL))
459 f4 &= ~(RF4_ATTACK_MASK);
460 f5 &= ~(RF5_ATTACK_MASK);
461 f6 &= ~(RF6_ATTACK_MASK);
464 if (!(target_ptr->pet_extra_flags & PF_SUMMON_SPELL))
466 f4 &= ~(RF4_SUMMON_MASK);
467 f5 &= ~(RF5_SUMMON_MASK);
468 f6 &= ~(RF6_SUMMON_MASK);
471 /* Prevent collateral damage */
472 if (!(target_ptr->pet_extra_flags & PF_BALL_SPELL) && (m_idx != target_ptr->riding))
474 if ((f4 & (RF4_BALL_MASK & ~(RF4_ROCKET))) ||
475 (f5 & RF5_BALL_MASK) ||
476 (f6 & RF6_BALL_MASK))
481 get_project_point(target_ptr, m_ptr->fy, m_ptr->fx, &real_y, &real_x, 0L);
483 if (projectable(target_ptr, real_y, real_x, target_ptr->y, target_ptr->x))
485 int dist = distance(real_y, real_x, target_ptr->y, target_ptr->x);
489 f4 &= ~(RF4_BALL_MASK & ~(RF4_ROCKET));
490 f5 &= ~(RF5_BALL_MASK);
491 f6 &= ~(RF6_BALL_MASK);
495 f4 &= ~(RF4_BIG_BALL_MASK);
496 f5 &= ~(RF5_BIG_BALL_MASK);
497 f6 &= ~(RF6_BIG_BALL_MASK);
500 else if (f5 & RF5_BA_LITE)
502 if ((distance(real_y, real_x, target_ptr->y, target_ptr->x) <= 4) && los(target_ptr, real_y, real_x, target_ptr->y, target_ptr->x))
503 f5 &= ~(RF5_BA_LITE);
512 get_project_point(target_ptr, m_ptr->fy, m_ptr->fx, &real_y, &real_x, PROJECT_STOP);
513 if (projectable(target_ptr, real_y, real_x, target_ptr->y, target_ptr->x) && (distance(real_y, real_x, target_ptr->y, target_ptr->x) <= 2))
517 if (((f4 & RF4_BEAM_MASK) || (f5 & RF5_BEAM_MASK) || (f6 & RF6_BEAM_MASK)) &&
518 !direct_beam(target_ptr, m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx, m_ptr))
520 f4 &= ~(RF4_BEAM_MASK);
521 f5 &= ~(RF5_BEAM_MASK);
522 f6 &= ~(RF6_BEAM_MASK);
525 if ((f4 & RF4_BREATH_MASK) || (f5 & RF5_BREATH_MASK) || (f6 & RF6_BREATH_MASK))
527 /* Expected breath radius */
528 POSITION rad = (r_ptr->flags2 & RF2_POWERFUL) ? 3 : 2;
530 if (!breath_direct(target_ptr, m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx, rad, 0, TRUE))
532 f4 &= ~(RF4_BREATH_MASK);
533 f5 &= ~(RF5_BREATH_MASK);
534 f6 &= ~(RF6_BREATH_MASK);
536 else if ((f4 & RF4_BR_LITE) &&
537 !breath_direct(target_ptr, m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx, rad, GF_LITE, TRUE))
539 f4 &= ~(RF4_BR_LITE);
541 else if ((f4 & RF4_BR_DISI) &&
542 !breath_direct(target_ptr, m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx, rad, GF_DISINTEGRATE, TRUE))
544 f4 &= ~(RF4_BR_DISI);
549 /* Special moves restriction */
550 if (f6 & RF6_SPECIAL)
552 if (m_ptr->r_idx == MON_ROLENTO)
554 if ((target_ptr->pet_extra_flags & (PF_ATTACK_SPELL | PF_SUMMON_SPELL)) != (PF_ATTACK_SPELL | PF_SUMMON_SPELL))
555 f6 &= ~(RF6_SPECIAL);
557 else if (r_ptr->d_char == 'B')
559 if ((target_ptr->pet_extra_flags & (PF_ATTACK_SPELL | PF_TELEPORT)) != (PF_ATTACK_SPELL | PF_TELEPORT))
560 f6 &= ~(RF6_SPECIAL);
562 else f6 &= ~(RF6_SPECIAL);
566 /* Remove some spells if necessary */
568 if (!(r_ptr->flags2 & RF2_STUPID))
570 /* Check for a clean bolt shot */
571 if (((f4 & RF4_BOLT_MASK) ||
572 (f5 & RF5_BOLT_MASK) ||
573 (f6 & RF6_BOLT_MASK)) &&
574 !clean_shot(target_ptr, m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx, pet))
576 f4 &= ~(RF4_BOLT_MASK);
577 f5 &= ~(RF5_BOLT_MASK);
578 f6 &= ~(RF6_BOLT_MASK);
581 /* Check for a possible summon */
582 if (((f4 & RF4_SUMMON_MASK) ||
583 (f5 & RF5_SUMMON_MASK) ||
584 (f6 & RF6_SUMMON_MASK)) &&
585 !(summon_possible(target_ptr, t_ptr->fy, t_ptr->fx)))
587 /* Remove summoning spells */
588 f4 &= ~(RF4_SUMMON_MASK);
589 f5 &= ~(RF5_SUMMON_MASK);
590 f6 &= ~(RF6_SUMMON_MASK);
594 if ((f4 & RF4_DISPEL) && !dispel_check_monster(target_ptr, m_idx, target_idx))
596 /* Remove dispel spell */
600 /* Check for a possible raise dead */
601 if ((f6 & RF6_RAISE_DEAD) && !raise_possible(target_ptr, m_ptr))
603 /* Remove raise dead spell */
604 f6 &= ~(RF6_RAISE_DEAD);
607 /* Special moves restriction */
608 if (f6 & RF6_SPECIAL)
610 if ((m_ptr->r_idx == MON_ROLENTO) && !summon_possible(target_ptr, t_ptr->fy, t_ptr->fx))
612 f6 &= ~(RF6_SPECIAL);
617 if (r_ptr->flags2 & RF2_SMART)
619 /* Hack -- allow "desperate" spells */
620 if ((m_ptr->hp < m_ptr->maxhp / 10) &&
621 (randint0(100) < 50))
623 /* Require intelligent spells */
624 f4 &= (RF4_INT_MASK);
625 f5 &= (RF5_INT_MASK);
626 f6 &= (RF6_INT_MASK);
629 /* Hack -- decline "teleport level" in some case */
630 if ((f6 & RF6_TELE_LEVEL) && is_teleport_level_ineffective(target_ptr, (target_idx == target_ptr->riding) ? 0 : target_idx))
632 f6 &= ~(RF6_TELE_LEVEL);
637 if (!f4 && !f5 && !f6) return FALSE;
639 /* Extract the "inate" spells */
640 for (k = 0; k < 32; k++)
642 if (f4 & (1L << k)) spell[num++] = k + RF4_SPELL_START;
645 /* Extract the "normal" spells */
646 for (k = 0; k < 32; k++)
648 if (f5 & (1L << k)) spell[num++] = k + RF5_SPELL_START;
651 /* Extract the "bizarre" spells */
652 for (k = 0; k < 32; k++)
654 if (f6 & (1L << k)) spell[num++] = k + RF6_SPELL_START;
658 if (!num) return FALSE;
660 /* Stop if player is dead or gone */
661 if (!target_ptr->playing || target_ptr->is_dead) return FALSE;
663 /* Handle "leaving" */
664 if (target_ptr->leaving) return FALSE;
666 /* Get the monster name (or "it") */
667 monster_desc(target_ptr, m_name, m_ptr, 0x00);
671 /* Get the monster possessive ("his"/"her"/"its") */
672 monster_desc(target_ptr, m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
675 /* Get the target's name (or "it") */
676 monster_desc(target_ptr, t_name, t_ptr, 0x00);
678 /* Choose a spell to cast */
679 thrown_spell = spell[randint0(num)];
681 if (target_ptr->riding && (m_idx == target_ptr->riding)) disturb(target_ptr, TRUE, TRUE);
683 /* Check for spell failure (inate attacks never fail) */
684 if (!spell_is_inate(thrown_spell) && (in_no_magic_dungeon || (MON_STUNNED(m_ptr) && one_in_(2))))
686 disturb(target_ptr, TRUE, TRUE);
687 if (see_m) msg_format(_("%^sは呪文を唱えようとしたが失敗した。",
688 "%^s tries to cast a spell, but fails."), m_name);
693 /* Hex: Anti Magic Barrier */
694 if (!spell_is_inate(thrown_spell) && magic_barrier(target_ptr, m_idx))
696 if (see_m) msg_format(_("反魔法バリアが%^sの呪文をかき消した。",
697 "Anti magic barrier cancels the spell which %^s casts."), m_name);
701 can_remember = is_original_ap_and_seen(target_ptr, m_ptr);
703 dam = monspell_to_monster(target_ptr, thrown_spell, y, x, m_idx, target_idx, FALSE);
704 if (dam < 0) return FALSE;
706 bool is_special_magic = m_ptr->ml;
707 is_special_magic &= maneable;
708 is_special_magic &= current_world_ptr->timewalk_m_idx == 0;
709 is_special_magic &= !target_ptr->blind;
710 is_special_magic &= target_ptr->pclass == CLASS_IMITATOR;
711 is_special_magic &= thrown_spell != 167; /* Not RF6_SPECIAL */
712 if (is_special_magic)
714 if (target_ptr->mane_num == MAX_MANE)
716 target_ptr->mane_num--;
717 for (int i = 0; i < target_ptr->mane_num - 1; i++)
719 target_ptr->mane_spell[i] = target_ptr->mane_spell[i + 1];
720 target_ptr->mane_dam[i] = target_ptr->mane_dam[i + 1];
724 target_ptr->mane_spell[target_ptr->mane_num] = thrown_spell - RF4_SPELL_START;
725 target_ptr->mane_dam[target_ptr->mane_num] = dam;
726 target_ptr->mane_num++;
727 target_ptr->new_mane = TRUE;
729 target_ptr->redraw |= PR_IMITATION;
732 /* Remember what the monster did, if we saw it */
736 if (thrown_spell < RF4_SPELL_START + RF4_SPELL_SIZE)
738 r_ptr->r_flags4 |= (1L << (thrown_spell - RF4_SPELL_START));
739 if (r_ptr->r_cast_spell < MAX_UCHAR) r_ptr->r_cast_spell++;
743 else if (thrown_spell < RF5_SPELL_START + RF5_SPELL_SIZE)
745 r_ptr->r_flags5 |= (1L << (thrown_spell - RF5_SPELL_START));
746 if (r_ptr->r_cast_spell < MAX_UCHAR) r_ptr->r_cast_spell++;
750 else if (thrown_spell < RF6_SPELL_START + RF6_SPELL_SIZE)
752 r_ptr->r_flags6 |= (1L << (thrown_spell - RF6_SPELL_START));
753 if (r_ptr->r_cast_spell < MAX_UCHAR) r_ptr->r_cast_spell++;
757 /* Always take note of monsters that kill you */
758 if (target_ptr->is_dead && (r_ptr->r_deaths < MAX_SHORT) && !floor_ptr->inside_arena)
760 r_ptr->r_deaths++; /* Ignore appearance difference */
763 /* A spell was cast */