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
16 #include "main/sound-definitions-table.h"
22 #include "realm/realm-hex.h"
23 #include "player-move.h"
24 #include "player-class.h"
26 #include "monster-status.h"
27 #include "monster-spell.h"
31 #include "view/display-main-window.h"
34 * @brief モンスターが敵対モンスターにビームを当てること可能かを判定する /
35 * Determine if a beam spell will hit the target.
36 * @param target_ptr プレーヤーへの参照ポインタ
41 * @param m_ptr 使用するモンスターの構造体参照ポインタ
42 * @return ビームが到達可能ならばTRUEを返す
44 static bool direct_beam(player_type *target_ptr, POSITION y1, POSITION x1, POSITION y2, POSITION x2, monster_type *m_ptr)
46 /* Check the projection path */
47 floor_type *floor_ptr = target_ptr->current_floor_ptr;
49 int grid_n = project_path(target_ptr, grid_g, MAX_RANGE, y1, x1, y2, x2, PROJECT_THRU);
51 /* No grid is ever projectable from itself */
52 if (!grid_n) return FALSE;
56 bool is_friend = is_pet(m_ptr);
57 for (int i = 0; i < grid_n; i++)
59 y = GRID_Y(grid_g[i]);
60 x = GRID_X(grid_g[i]);
62 if (y == y2 && x == x2)
64 else if (is_friend && floor_ptr->grid_array[y][x].m_idx > 0 &&
65 !are_enemies(target_ptr, m_ptr, &floor_ptr->m_list[floor_ptr->grid_array[y][x].m_idx]))
67 /* Friends don't shoot friends */
71 if (is_friend && player_bold(target_ptr, y, x))
75 if (!hit2) return FALSE;
81 * @brief モンスターが敵対モンスターに直接ブレスを当てることが可能かを判定する /
82 * Determine if a breath will hit the target.
89 * @param is_friend TRUEならば、プレイヤーを巻き込む時にブレスの判定をFALSEにする。
90 * @return ブレスを直接当てられるならばTRUEを返す
92 static bool breath_direct(player_type *master_ptr, POSITION y1, POSITION x1, POSITION y2, POSITION x2, POSITION rad, EFFECT_ID typ, bool is_friend)
101 case GF_DISINTEGRATE:
109 /* Check the projection path */
111 int grid_n = project_path(master_ptr, grid_g, MAX_RANGE, y1, x1, y2, x2, flg);
113 /* Project along the path */
117 for (i = 0; i < grid_n; ++i)
119 int ny = GRID_Y(grid_g[i]);
120 int nx = GRID_X(grid_g[i]);
122 if (flg & PROJECT_DISI)
124 /* Hack -- Balls explode before reaching walls */
125 if (cave_stop_disintegration(master_ptr->current_floor_ptr, ny, nx)) break;
127 else if (flg & PROJECT_LOS)
129 /* Hack -- Balls explode before reaching walls */
130 if (!cave_los_bold(master_ptr->current_floor_ptr, ny, nx)) break;
134 /* Hack -- Balls explode before reaching walls */
135 if (!cave_have_flag_bold(master_ptr->current_floor_ptr, ny, nx, FF_PROJECT)) break;
138 /* Save the "blast epicenter" */
149 if (flg & PROJECT_DISI)
151 if (in_disintegration_range(master_ptr->current_floor_ptr, y1, x1, y2, x2) && (distance(y1, x1, y2, x2) <= rad)) hit2 = TRUE;
152 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;
154 else if (flg & PROJECT_LOS)
156 if (los(master_ptr, y1, x1, y2, x2) && (distance(y1, x1, y2, x2) <= rad)) hit2 = TRUE;
157 if (los(master_ptr, y1, x1, master_ptr->y, master_ptr->x) && (distance(y1, x1, master_ptr->y, master_ptr->x) <= rad)) hityou = TRUE;
161 if (projectable(master_ptr, y1, x1, y2, x2) && (distance(y1, x1, y2, x2) <= rad)) hit2 = TRUE;
162 if (projectable(master_ptr, y1, x1, master_ptr->y, master_ptr->x) && (distance(y1, x1, master_ptr->y, master_ptr->x) <= rad)) hityou = TRUE;
168 POSITION gx[1024], gy[1024];
170 POSITION gm_rad = rad;
171 breath_shape(master_ptr, grid_g, grid_n, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, y, x, typ);
173 for (i = 0; i < grids; i++)
177 if ((y == y2) && (x == x2)) hit2 = TRUE;
178 if (player_bold(master_ptr, y, x)) hityou = TRUE;
182 if (!hit2) return FALSE;
183 if (is_friend && hityou) return FALSE;
190 * @brief モンスターが特殊能力の目標地点を決める処理 /
191 * Get the actual center point of ball spells (rad > 1) (originally from TOband)
192 * @param target_ptr プレーヤーへの参照ポインタ
195 * @param ty 目標Y座標を返す参照ポインタ
196 * @param tx 目標X座標を返す参照ポインタ
197 * @param flg 判定のフラグ配列
200 void get_project_point(player_type *target_ptr, POSITION sy, POSITION sx, POSITION *ty, POSITION *tx, BIT_FLAGS flg)
203 int path_n = project_path(target_ptr, path_g, MAX_RANGE, sy, sx, *ty, *tx, flg);
208 /* Project along the path */
209 for (int i = 0; i < path_n; i++)
211 sy = GRID_Y(path_g[i]);
212 sx = GRID_X(path_g[i]);
214 /* Hack -- Balls explode before reaching walls */
215 if (!cave_have_flag_bold(target_ptr->current_floor_ptr, sy, sx, FF_PROJECT)) break;
224 * @brief モンスターが敵モンスターに魔力消去を使うかどうかを返す /
225 * Check should monster cast dispel spell at other monster.
226 * @param target_ptr プレーヤーへの参照ポインタ
227 * @param m_idx 術者のモンスターID
228 * @param t_idx 目標のモンスターID
229 * @return 魔力消去を使うべきならばTRUEを変えす。
231 static bool dispel_check_monster(player_type *target_ptr, MONSTER_IDX m_idx, MONSTER_IDX t_idx)
233 monster_type *t_ptr = &target_ptr->current_floor_ptr->m_list[t_idx];
234 if (MON_INVULNER(t_ptr)) return TRUE;
236 if ((t_ptr->mspeed < 135) && MON_FAST(t_ptr)) return TRUE;
239 if ((t_idx == target_ptr->riding) && dispel_check(target_ptr, m_idx)) return TRUE;
241 /* No need to cast dispel spell */
247 * todo モンスターからモンスターへの呪文なのにplayer_typeが引数になり得るのは間違っている……
248 * @brief モンスターが敵モンスターに特殊能力を使う処理のメインルーチン /
249 * Monster tries to 'cast a spell' (or breath, etc) at another monster.
250 * @param target_ptr プレーヤーへの参照ポインタ
251 * @param m_idx 術者のモンスターID
252 * @return 実際に特殊能力を使った場合TRUEを返す
254 * The player is only disturbed if able to be affected by the spell.
256 bool monst_spell_monst(player_type *target_ptr, MONSTER_IDX m_idx)
258 POSITION y = 0, x = 0;
260 MONSTER_IDX target_idx = 0;
266 byte spell[96], num = 0;
268 GAME_TEXT m_name[160];
269 GAME_TEXT t_name[160];
277 floor_type *floor_ptr = target_ptr->current_floor_ptr;
278 monster_type *m_ptr = &floor_ptr->m_list[m_idx];
279 monster_type *t_ptr = NULL;
281 monster_race *r_ptr = &r_info[m_ptr->r_idx];
283 bool see_m = is_seen(m_ptr);
284 bool maneable = player_has_los_bold(target_ptr, m_ptr->fy, m_ptr->fx);
285 bool pet = is_pet(m_ptr);
287 bool in_no_magic_dungeon = (d_info[target_ptr->dungeon_idx].flags1 & DF1_NO_MAGIC) && floor_ptr->dun_level
288 && (!floor_ptr->inside_quest || is_fixed_quest_idx(floor_ptr->inside_quest));
290 bool can_use_lite_area = FALSE;
293 /* Cannot cast spells when confused */
294 if (MON_CONFUSED(m_ptr)) return FALSE;
296 /* Extract the racial spell flags */
297 BIT_FLAGS f4 = r_ptr->flags4;
298 BIT_FLAGS f5 = r_ptr->a_ability_flags1;
299 BIT_FLAGS f6 = r_ptr->a_ability_flags2;
301 /* Target is given for pet? */
302 if (target_ptr->pet_t_m_idx && pet)
304 target_idx = target_ptr->pet_t_m_idx;
305 t_ptr = &floor_ptr->m_list[target_idx];
307 /* Cancel if not projectable (for now) */
308 if ((m_idx == target_idx) || !projectable(target_ptr, m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx))
314 /* Is there counter attack target? */
315 if (!target_idx && m_ptr->target_y)
317 target_idx = floor_ptr->grid_array[m_ptr->target_y][m_ptr->target_x].m_idx;
321 t_ptr = &floor_ptr->m_list[target_idx];
323 /* Cancel if neither enemy nor a given target */
324 if ((m_idx == target_idx) ||
325 ((target_idx != target_ptr->pet_t_m_idx) && !are_enemies(target_ptr, m_ptr, t_ptr)))
330 /* Allow only summoning etc.. if not projectable */
331 else if (!projectable(target_ptr, m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx))
333 f4 &= (RF4_INDIRECT_MASK);
334 f5 &= (RF5_INDIRECT_MASK);
335 f6 &= (RF6_INDIRECT_MASK);
340 /* Look for enemies normally */
343 bool success = FALSE;
345 if (target_ptr->phase_out)
347 start = randint1(floor_ptr->m_max - 1) + floor_ptr->m_max;
348 if (randint0(2)) plus = -1;
350 else start = floor_ptr->m_max + 1;
352 /* Scan thru all monsters */
353 for (int i = start; ((i < start + floor_ptr->m_max) && (i > start - floor_ptr->m_max)); i += plus)
355 MONSTER_IDX dummy = (i % floor_ptr->m_max);
356 if (!dummy) continue;
359 t_ptr = &floor_ptr->m_list[target_idx];
361 if (!monster_is_valid(t_ptr)) continue;
363 /* Monster must be 'an enemy' */
364 if ((m_idx == target_idx) || !are_enemies(target_ptr, m_ptr, t_ptr)) continue;
366 /* Monster must be projectable */
367 if (!projectable(target_ptr, m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx)) continue;
375 if (!success) return FALSE;
378 /* OK -- we've got a target */
382 /* Forget old counter attack target */
385 /* Remove unimplemented spells */
386 f6 &= ~(RF6_WORLD | RF6_TRAPS | RF6_FORGET);
388 if (f4 & RF4_BR_LITE)
390 if (!los(target_ptr, m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx))
391 f4 &= ~(RF4_BR_LITE);
394 /* Remove unimplemented special moves */
395 if (f6 & RF6_SPECIAL)
397 if ((m_ptr->r_idx != MON_ROLENTO) && (r_ptr->d_char != 'B'))
398 f6 &= ~(RF6_SPECIAL);
401 if (f6 & RF6_DARKNESS)
403 bool vs_ninja = (target_ptr->pclass == CLASS_NINJA) && !is_hostile(t_ptr);
406 !(r_ptr->flags3 & (RF3_UNDEAD | RF3_HURT_LITE)) &&
407 !(r_ptr->flags7 & RF7_DARK_MASK))
408 can_use_lite_area = TRUE;
410 if (!(r_ptr->flags2 & RF2_STUPID))
412 if (d_info[target_ptr->dungeon_idx].flags1 & DF1_DARKNESS) f6 &= ~(RF6_DARKNESS);
413 else if (vs_ninja && !can_use_lite_area) f6 &= ~(RF6_DARKNESS);
417 if (in_no_magic_dungeon && !(r_ptr->flags2 & RF2_STUPID))
419 f4 &= (RF4_NOMAGIC_MASK);
420 f5 &= (RF5_NOMAGIC_MASK);
421 f6 &= (RF6_NOMAGIC_MASK);
424 if (floor_ptr->inside_arena || target_ptr->phase_out)
426 f4 &= ~(RF4_SUMMON_MASK);
427 f5 &= ~(RF5_SUMMON_MASK);
428 f6 &= ~(RF6_SUMMON_MASK | RF6_TELE_LEVEL);
430 if (m_ptr->r_idx == MON_ROLENTO) f6 &= ~(RF6_SPECIAL);
433 if (target_ptr->phase_out && !one_in_(3))
438 if (m_idx == target_ptr->riding)
440 f4 &= ~(RF4_RIDING_MASK);
441 f5 &= ~(RF5_RIDING_MASK);
442 f6 &= ~(RF6_RIDING_MASK);
448 f6 &= ~(RF6_DARKNESS | RF6_TRAPS);
450 if (!(target_ptr->pet_extra_flags & PF_TELEPORT))
452 f6 &= ~(RF6_BLINK | RF6_TPORT | RF6_TELE_TO | RF6_TELE_AWAY | RF6_TELE_LEVEL);
455 if (!(target_ptr->pet_extra_flags & PF_ATTACK_SPELL))
457 f4 &= ~(RF4_ATTACK_MASK);
458 f5 &= ~(RF5_ATTACK_MASK);
459 f6 &= ~(RF6_ATTACK_MASK);
462 if (!(target_ptr->pet_extra_flags & PF_SUMMON_SPELL))
464 f4 &= ~(RF4_SUMMON_MASK);
465 f5 &= ~(RF5_SUMMON_MASK);
466 f6 &= ~(RF6_SUMMON_MASK);
469 /* Prevent collateral damage */
470 if (!(target_ptr->pet_extra_flags & PF_BALL_SPELL) && (m_idx != target_ptr->riding))
472 if ((f4 & (RF4_BALL_MASK & ~(RF4_ROCKET))) ||
473 (f5 & RF5_BALL_MASK) ||
474 (f6 & RF6_BALL_MASK))
479 get_project_point(target_ptr, m_ptr->fy, m_ptr->fx, &real_y, &real_x, 0L);
481 if (projectable(target_ptr, real_y, real_x, target_ptr->y, target_ptr->x))
483 int dist = distance(real_y, real_x, target_ptr->y, target_ptr->x);
487 f4 &= ~(RF4_BALL_MASK & ~(RF4_ROCKET));
488 f5 &= ~(RF5_BALL_MASK);
489 f6 &= ~(RF6_BALL_MASK);
493 f4 &= ~(RF4_BIG_BALL_MASK);
494 f5 &= ~(RF5_BIG_BALL_MASK);
495 f6 &= ~(RF6_BIG_BALL_MASK);
498 else if (f5 & RF5_BA_LITE)
500 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))
501 f5 &= ~(RF5_BA_LITE);
510 get_project_point(target_ptr, m_ptr->fy, m_ptr->fx, &real_y, &real_x, PROJECT_STOP);
511 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))
515 if (((f4 & RF4_BEAM_MASK) || (f5 & RF5_BEAM_MASK) || (f6 & RF6_BEAM_MASK)) &&
516 !direct_beam(target_ptr, m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx, m_ptr))
518 f4 &= ~(RF4_BEAM_MASK);
519 f5 &= ~(RF5_BEAM_MASK);
520 f6 &= ~(RF6_BEAM_MASK);
523 if ((f4 & RF4_BREATH_MASK) || (f5 & RF5_BREATH_MASK) || (f6 & RF6_BREATH_MASK))
525 /* Expected breath radius */
526 POSITION rad = (r_ptr->flags2 & RF2_POWERFUL) ? 3 : 2;
528 if (!breath_direct(target_ptr, m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx, rad, 0, TRUE))
530 f4 &= ~(RF4_BREATH_MASK);
531 f5 &= ~(RF5_BREATH_MASK);
532 f6 &= ~(RF6_BREATH_MASK);
534 else if ((f4 & RF4_BR_LITE) &&
535 !breath_direct(target_ptr, m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx, rad, GF_LITE, TRUE))
537 f4 &= ~(RF4_BR_LITE);
539 else if ((f4 & RF4_BR_DISI) &&
540 !breath_direct(target_ptr, m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx, rad, GF_DISINTEGRATE, TRUE))
542 f4 &= ~(RF4_BR_DISI);
547 /* Special moves restriction */
548 if (f6 & RF6_SPECIAL)
550 if (m_ptr->r_idx == MON_ROLENTO)
552 if ((target_ptr->pet_extra_flags & (PF_ATTACK_SPELL | PF_SUMMON_SPELL)) != (PF_ATTACK_SPELL | PF_SUMMON_SPELL))
553 f6 &= ~(RF6_SPECIAL);
555 else if (r_ptr->d_char == 'B')
557 if ((target_ptr->pet_extra_flags & (PF_ATTACK_SPELL | PF_TELEPORT)) != (PF_ATTACK_SPELL | PF_TELEPORT))
558 f6 &= ~(RF6_SPECIAL);
560 else f6 &= ~(RF6_SPECIAL);
564 /* Remove some spells if necessary */
566 if (!(r_ptr->flags2 & RF2_STUPID))
568 /* Check for a clean bolt shot */
569 if (((f4 & RF4_BOLT_MASK) ||
570 (f5 & RF5_BOLT_MASK) ||
571 (f6 & RF6_BOLT_MASK)) &&
572 !clean_shot(target_ptr, m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx, pet))
574 f4 &= ~(RF4_BOLT_MASK);
575 f5 &= ~(RF5_BOLT_MASK);
576 f6 &= ~(RF6_BOLT_MASK);
579 /* Check for a possible summon */
580 if (((f4 & RF4_SUMMON_MASK) ||
581 (f5 & RF5_SUMMON_MASK) ||
582 (f6 & RF6_SUMMON_MASK)) &&
583 !(summon_possible(target_ptr, t_ptr->fy, t_ptr->fx)))
585 /* Remove summoning spells */
586 f4 &= ~(RF4_SUMMON_MASK);
587 f5 &= ~(RF5_SUMMON_MASK);
588 f6 &= ~(RF6_SUMMON_MASK);
592 if ((f4 & RF4_DISPEL) && !dispel_check_monster(target_ptr, m_idx, target_idx))
594 /* Remove dispel spell */
598 /* Check for a possible raise dead */
599 if ((f6 & RF6_RAISE_DEAD) && !raise_possible(target_ptr, m_ptr))
601 /* Remove raise dead spell */
602 f6 &= ~(RF6_RAISE_DEAD);
605 /* Special moves restriction */
606 if (f6 & RF6_SPECIAL)
608 if ((m_ptr->r_idx == MON_ROLENTO) && !summon_possible(target_ptr, t_ptr->fy, t_ptr->fx))
610 f6 &= ~(RF6_SPECIAL);
615 if (r_ptr->flags2 & RF2_SMART)
617 /* Hack -- allow "desperate" spells */
618 if ((m_ptr->hp < m_ptr->maxhp / 10) &&
619 (randint0(100) < 50))
621 /* Require intelligent spells */
622 f4 &= (RF4_INT_MASK);
623 f5 &= (RF5_INT_MASK);
624 f6 &= (RF6_INT_MASK);
627 /* Hack -- decline "teleport level" in some case */
628 if ((f6 & RF6_TELE_LEVEL) && is_teleport_level_ineffective(target_ptr, (target_idx == target_ptr->riding) ? 0 : target_idx))
630 f6 &= ~(RF6_TELE_LEVEL);
635 if (!f4 && !f5 && !f6) return FALSE;
637 /* Extract the "inate" spells */
638 for (k = 0; k < 32; k++)
640 if (f4 & (1L << k)) spell[num++] = k + RF4_SPELL_START;
643 /* Extract the "normal" spells */
644 for (k = 0; k < 32; k++)
646 if (f5 & (1L << k)) spell[num++] = k + RF5_SPELL_START;
649 /* Extract the "bizarre" spells */
650 for (k = 0; k < 32; k++)
652 if (f6 & (1L << k)) spell[num++] = k + RF6_SPELL_START;
656 if (!num) return FALSE;
658 /* Stop if player is dead or gone */
659 if (!target_ptr->playing || target_ptr->is_dead) return FALSE;
661 /* Handle "leaving" */
662 if (target_ptr->leaving) return FALSE;
664 /* Get the monster name (or "it") */
665 monster_desc(target_ptr, m_name, m_ptr, 0x00);
669 /* Get the monster possessive ("his"/"her"/"its") */
670 monster_desc(target_ptr, m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
673 /* Get the target's name (or "it") */
674 monster_desc(target_ptr, t_name, t_ptr, 0x00);
676 /* Choose a spell to cast */
677 thrown_spell = spell[randint0(num)];
679 if (target_ptr->riding && (m_idx == target_ptr->riding)) disturb(target_ptr, TRUE, TRUE);
681 /* Check for spell failure (inate attacks never fail) */
682 if (!spell_is_inate(thrown_spell) && (in_no_magic_dungeon || (MON_STUNNED(m_ptr) && one_in_(2))))
684 disturb(target_ptr, TRUE, TRUE);
685 if (see_m) msg_format(_("%^sは呪文を唱えようとしたが失敗した。",
686 "%^s tries to cast a spell, but fails."), m_name);
691 /* Hex: Anti Magic Barrier */
692 if (!spell_is_inate(thrown_spell) && magic_barrier(target_ptr, m_idx))
694 if (see_m) msg_format(_("反魔法バリアが%^sの呪文をかき消した。",
695 "Anti magic barrier cancels the spell which %^s casts."), m_name);
699 can_remember = is_original_ap_and_seen(target_ptr, m_ptr);
701 dam = monspell_to_monster(target_ptr, thrown_spell, y, x, m_idx, target_idx, FALSE);
702 if (dam < 0) return FALSE;
704 bool is_special_magic = m_ptr->ml;
705 is_special_magic &= maneable;
706 is_special_magic &= current_world_ptr->timewalk_m_idx == 0;
707 is_special_magic &= !target_ptr->blind;
708 is_special_magic &= target_ptr->pclass == CLASS_IMITATOR;
709 is_special_magic &= thrown_spell != 167; /* Not RF6_SPECIAL */
710 if (is_special_magic)
712 if (target_ptr->mane_num == MAX_MANE)
714 target_ptr->mane_num--;
715 for (int i = 0; i < target_ptr->mane_num - 1; i++)
717 target_ptr->mane_spell[i] = target_ptr->mane_spell[i + 1];
718 target_ptr->mane_dam[i] = target_ptr->mane_dam[i + 1];
722 target_ptr->mane_spell[target_ptr->mane_num] = thrown_spell - RF4_SPELL_START;
723 target_ptr->mane_dam[target_ptr->mane_num] = dam;
724 target_ptr->mane_num++;
725 target_ptr->new_mane = TRUE;
727 target_ptr->redraw |= PR_IMITATION;
730 /* Remember what the monster did, if we saw it */
734 if (thrown_spell < RF4_SPELL_START + RF4_SPELL_SIZE)
736 r_ptr->r_flags4 |= (1L << (thrown_spell - RF4_SPELL_START));
737 if (r_ptr->r_cast_spell < MAX_UCHAR) r_ptr->r_cast_spell++;
741 else if (thrown_spell < RF5_SPELL_START + RF5_SPELL_SIZE)
743 r_ptr->r_flags5 |= (1L << (thrown_spell - RF5_SPELL_START));
744 if (r_ptr->r_cast_spell < MAX_UCHAR) r_ptr->r_cast_spell++;
748 else if (thrown_spell < RF6_SPELL_START + RF6_SPELL_SIZE)
750 r_ptr->r_flags6 |= (1L << (thrown_spell - RF6_SPELL_START));
751 if (r_ptr->r_cast_spell < MAX_UCHAR) r_ptr->r_cast_spell++;
755 /* Always take note of monsters that kill you */
756 if (target_ptr->is_dead && (r_ptr->r_deaths < MAX_SHORT) && !floor_ptr->inside_arena)
758 r_ptr->r_deaths++; /* Ignore appearance difference */
761 /* A spell was cast */