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"
19 #include "effect/effect-characteristics.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"
28 #include "spell/spells-type.h"
30 #include "world/world.h"
31 #include "view/display-main-window.h"
32 #include "spell/spells3.h"
35 * @brief モンスターが敵対モンスターにビームを当てること可能かを判定する /
36 * Determine if a beam spell will hit the target.
37 * @param target_ptr プレーヤーへの参照ポインタ
42 * @param m_ptr 使用するモンスターの構造体参照ポインタ
43 * @return ビームが到達可能ならばTRUEを返す
45 static bool direct_beam(player_type *target_ptr, POSITION y1, POSITION x1, POSITION y2, POSITION x2, monster_type *m_ptr)
47 /* Check the projection path */
48 floor_type *floor_ptr = target_ptr->current_floor_ptr;
50 int grid_n = project_path(target_ptr, grid_g, MAX_RANGE, y1, x1, y2, x2, PROJECT_THRU);
52 /* No grid is ever projectable from itself */
53 if (!grid_n) return FALSE;
57 bool is_friend = is_pet(m_ptr);
58 for (int i = 0; i < grid_n; i++)
60 y = GRID_Y(grid_g[i]);
61 x = GRID_X(grid_g[i]);
63 if (y == y2 && x == x2)
65 else if (is_friend && floor_ptr->grid_array[y][x].m_idx > 0 &&
66 !are_enemies(target_ptr, m_ptr, &floor_ptr->m_list[floor_ptr->grid_array[y][x].m_idx]))
68 /* Friends don't shoot friends */
72 if (is_friend && player_bold(target_ptr, y, x))
76 if (!hit2) return FALSE;
82 * @brief モンスターが敵対モンスターに直接ブレスを当てることが可能かを判定する /
83 * Determine if a breath will hit the target.
90 * @param is_friend TRUEならば、プレイヤーを巻き込む時にブレスの判定をFALSEにする。
91 * @return ブレスを直接当てられるならばTRUEを返す
93 static bool breath_direct(player_type *master_ptr, POSITION y1, POSITION x1, POSITION y2, POSITION x2, POSITION rad, EFFECT_ID typ, bool is_friend)
102 case GF_DISINTEGRATE:
110 /* Check the projection path */
112 int grid_n = project_path(master_ptr, grid_g, MAX_RANGE, y1, x1, y2, x2, flg);
114 /* Project along the path */
118 for (i = 0; i < grid_n; ++i)
120 int ny = GRID_Y(grid_g[i]);
121 int nx = GRID_X(grid_g[i]);
123 if (flg & PROJECT_DISI)
125 /* Hack -- Balls explode before reaching walls */
126 if (cave_stop_disintegration(master_ptr->current_floor_ptr, ny, nx)) break;
128 else if (flg & PROJECT_LOS)
130 /* Hack -- Balls explode before reaching walls */
131 if (!cave_los_bold(master_ptr->current_floor_ptr, ny, nx)) break;
135 /* Hack -- Balls explode before reaching walls */
136 if (!cave_have_flag_bold(master_ptr->current_floor_ptr, ny, nx, FF_PROJECT)) break;
139 /* Save the "blast epicenter" */
150 if (flg & PROJECT_DISI)
152 if (in_disintegration_range(master_ptr->current_floor_ptr, y1, x1, y2, x2) && (distance(y1, x1, y2, x2) <= rad)) hit2 = TRUE;
153 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;
155 else if (flg & PROJECT_LOS)
157 if (los(master_ptr, y1, x1, y2, x2) && (distance(y1, x1, y2, x2) <= rad)) hit2 = TRUE;
158 if (los(master_ptr, y1, x1, master_ptr->y, master_ptr->x) && (distance(y1, x1, master_ptr->y, master_ptr->x) <= rad)) hityou = TRUE;
162 if (projectable(master_ptr, y1, x1, y2, x2) && (distance(y1, x1, y2, x2) <= rad)) hit2 = TRUE;
163 if (projectable(master_ptr, y1, x1, master_ptr->y, master_ptr->x) && (distance(y1, x1, master_ptr->y, master_ptr->x) <= rad)) hityou = TRUE;
169 POSITION gx[1024], gy[1024];
171 POSITION gm_rad = rad;
172 breath_shape(master_ptr, grid_g, grid_n, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, y, x, typ);
174 for (i = 0; i < grids; i++)
178 if ((y == y2) && (x == x2)) hit2 = TRUE;
179 if (player_bold(master_ptr, y, x)) hityou = TRUE;
183 if (!hit2) return FALSE;
184 if (is_friend && hityou) return FALSE;
191 * @brief モンスターが特殊能力の目標地点を決める処理 /
192 * Get the actual center point of ball spells (rad > 1) (originally from TOband)
193 * @param target_ptr プレーヤーへの参照ポインタ
196 * @param ty 目標Y座標を返す参照ポインタ
197 * @param tx 目標X座標を返す参照ポインタ
198 * @param flg 判定のフラグ配列
201 void get_project_point(player_type *target_ptr, POSITION sy, POSITION sx, POSITION *ty, POSITION *tx, BIT_FLAGS flg)
204 int path_n = project_path(target_ptr, path_g, MAX_RANGE, sy, sx, *ty, *tx, flg);
209 /* Project along the path */
210 for (int i = 0; i < path_n; i++)
212 sy = GRID_Y(path_g[i]);
213 sx = GRID_X(path_g[i]);
215 /* Hack -- Balls explode before reaching walls */
216 if (!cave_have_flag_bold(target_ptr->current_floor_ptr, sy, sx, FF_PROJECT)) break;
225 * @brief モンスターが敵モンスターに魔力消去を使うかどうかを返す /
226 * Check should monster cast dispel spell at other monster.
227 * @param target_ptr プレーヤーへの参照ポインタ
228 * @param m_idx 術者のモンスターID
229 * @param t_idx 目標のモンスターID
230 * @return 魔力消去を使うべきならばTRUEを変えす。
232 static bool dispel_check_monster(player_type *target_ptr, MONSTER_IDX m_idx, MONSTER_IDX t_idx)
234 monster_type *t_ptr = &target_ptr->current_floor_ptr->m_list[t_idx];
235 if (MON_INVULNER(t_ptr)) return TRUE;
237 if ((t_ptr->mspeed < 135) && MON_FAST(t_ptr)) return TRUE;
240 if ((t_idx == target_ptr->riding) && dispel_check(target_ptr, m_idx)) return TRUE;
242 /* No need to cast dispel spell */
248 * todo モンスターからモンスターへの呪文なのにplayer_typeが引数になり得るのは間違っている……
249 * @brief モンスターが敵モンスターに特殊能力を使う処理のメインルーチン /
250 * Monster tries to 'cast a spell' (or breath, etc) at another monster.
251 * @param target_ptr プレーヤーへの参照ポインタ
252 * @param m_idx 術者のモンスターID
253 * @return 実際に特殊能力を使った場合TRUEを返す
255 * The player is only disturbed if able to be affected by the spell.
257 bool monst_spell_monst(player_type *target_ptr, MONSTER_IDX m_idx)
259 POSITION y = 0, x = 0;
261 MONSTER_IDX target_idx = 0;
267 byte spell[96], num = 0;
269 GAME_TEXT m_name[160];
270 GAME_TEXT t_name[160];
278 floor_type *floor_ptr = target_ptr->current_floor_ptr;
279 monster_type *m_ptr = &floor_ptr->m_list[m_idx];
280 monster_type *t_ptr = NULL;
282 monster_race *r_ptr = &r_info[m_ptr->r_idx];
284 bool see_m = is_seen(m_ptr);
285 bool maneable = player_has_los_bold(target_ptr, m_ptr->fy, m_ptr->fx);
286 bool pet = is_pet(m_ptr);
288 bool in_no_magic_dungeon = (d_info[target_ptr->dungeon_idx].flags1 & DF1_NO_MAGIC) && floor_ptr->dun_level
289 && (!floor_ptr->inside_quest || is_fixed_quest_idx(floor_ptr->inside_quest));
291 bool can_use_lite_area = FALSE;
294 /* Cannot cast spells when confused */
295 if (MON_CONFUSED(m_ptr)) return FALSE;
297 /* Extract the racial spell flags */
298 BIT_FLAGS f4 = r_ptr->flags4;
299 BIT_FLAGS f5 = r_ptr->a_ability_flags1;
300 BIT_FLAGS f6 = r_ptr->a_ability_flags2;
302 /* Target is given for pet? */
303 if (target_ptr->pet_t_m_idx && pet)
305 target_idx = target_ptr->pet_t_m_idx;
306 t_ptr = &floor_ptr->m_list[target_idx];
308 /* Cancel if not projectable (for now) */
309 if ((m_idx == target_idx) || !projectable(target_ptr, m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx))
315 /* Is there counter attack target? */
316 if (!target_idx && m_ptr->target_y)
318 target_idx = floor_ptr->grid_array[m_ptr->target_y][m_ptr->target_x].m_idx;
322 t_ptr = &floor_ptr->m_list[target_idx];
324 /* Cancel if neither enemy nor a given target */
325 if ((m_idx == target_idx) ||
326 ((target_idx != target_ptr->pet_t_m_idx) && !are_enemies(target_ptr, m_ptr, t_ptr)))
331 /* Allow only summoning etc.. if not projectable */
332 else if (!projectable(target_ptr, m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx))
334 f4 &= (RF4_INDIRECT_MASK);
335 f5 &= (RF5_INDIRECT_MASK);
336 f6 &= (RF6_INDIRECT_MASK);
341 /* Look for enemies normally */
344 bool success = FALSE;
346 if (target_ptr->phase_out)
348 start = randint1(floor_ptr->m_max - 1) + floor_ptr->m_max;
349 if (randint0(2)) plus = -1;
351 else start = floor_ptr->m_max + 1;
353 /* Scan thru all monsters */
354 for (int i = start; ((i < start + floor_ptr->m_max) && (i > start - floor_ptr->m_max)); i += plus)
356 MONSTER_IDX dummy = (i % floor_ptr->m_max);
357 if (!dummy) continue;
360 t_ptr = &floor_ptr->m_list[target_idx];
362 if (!monster_is_valid(t_ptr)) continue;
364 /* Monster must be 'an enemy' */
365 if ((m_idx == target_idx) || !are_enemies(target_ptr, m_ptr, t_ptr)) continue;
367 /* Monster must be projectable */
368 if (!projectable(target_ptr, m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx)) continue;
376 if (!success) return FALSE;
379 /* OK -- we've got a target */
383 /* Forget old counter attack target */
386 /* Remove unimplemented spells */
387 f6 &= ~(RF6_WORLD | RF6_TRAPS | RF6_FORGET);
389 if (f4 & RF4_BR_LITE)
391 if (!los(target_ptr, m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx))
392 f4 &= ~(RF4_BR_LITE);
395 /* Remove unimplemented special moves */
396 if (f6 & RF6_SPECIAL)
398 if ((m_ptr->r_idx != MON_ROLENTO) && (r_ptr->d_char != 'B'))
399 f6 &= ~(RF6_SPECIAL);
402 if (f6 & RF6_DARKNESS)
404 bool vs_ninja = (target_ptr->pclass == CLASS_NINJA) && !is_hostile(t_ptr);
407 !(r_ptr->flags3 & (RF3_UNDEAD | RF3_HURT_LITE)) &&
408 !(r_ptr->flags7 & RF7_DARK_MASK))
409 can_use_lite_area = TRUE;
411 if (!(r_ptr->flags2 & RF2_STUPID))
413 if (d_info[target_ptr->dungeon_idx].flags1 & DF1_DARKNESS) f6 &= ~(RF6_DARKNESS);
414 else if (vs_ninja && !can_use_lite_area) f6 &= ~(RF6_DARKNESS);
418 if (in_no_magic_dungeon && !(r_ptr->flags2 & RF2_STUPID))
420 f4 &= (RF4_NOMAGIC_MASK);
421 f5 &= (RF5_NOMAGIC_MASK);
422 f6 &= (RF6_NOMAGIC_MASK);
425 if (floor_ptr->inside_arena || target_ptr->phase_out)
427 f4 &= ~(RF4_SUMMON_MASK);
428 f5 &= ~(RF5_SUMMON_MASK);
429 f6 &= ~(RF6_SUMMON_MASK | RF6_TELE_LEVEL);
431 if (m_ptr->r_idx == MON_ROLENTO) f6 &= ~(RF6_SPECIAL);
434 if (target_ptr->phase_out && !one_in_(3))
439 if (m_idx == target_ptr->riding)
441 f4 &= ~(RF4_RIDING_MASK);
442 f5 &= ~(RF5_RIDING_MASK);
443 f6 &= ~(RF6_RIDING_MASK);
449 f6 &= ~(RF6_DARKNESS | RF6_TRAPS);
451 if (!(target_ptr->pet_extra_flags & PF_TELEPORT))
453 f6 &= ~(RF6_BLINK | RF6_TPORT | RF6_TELE_TO | RF6_TELE_AWAY | RF6_TELE_LEVEL);
456 if (!(target_ptr->pet_extra_flags & PF_ATTACK_SPELL))
458 f4 &= ~(RF4_ATTACK_MASK);
459 f5 &= ~(RF5_ATTACK_MASK);
460 f6 &= ~(RF6_ATTACK_MASK);
463 if (!(target_ptr->pet_extra_flags & PF_SUMMON_SPELL))
465 f4 &= ~(RF4_SUMMON_MASK);
466 f5 &= ~(RF5_SUMMON_MASK);
467 f6 &= ~(RF6_SUMMON_MASK);
470 /* Prevent collateral damage */
471 if (!(target_ptr->pet_extra_flags & PF_BALL_SPELL) && (m_idx != target_ptr->riding))
473 if ((f4 & (RF4_BALL_MASK & ~(RF4_ROCKET))) ||
474 (f5 & RF5_BALL_MASK) ||
475 (f6 & RF6_BALL_MASK))
480 get_project_point(target_ptr, m_ptr->fy, m_ptr->fx, &real_y, &real_x, 0L);
482 if (projectable(target_ptr, real_y, real_x, target_ptr->y, target_ptr->x))
484 int dist = distance(real_y, real_x, target_ptr->y, target_ptr->x);
488 f4 &= ~(RF4_BALL_MASK & ~(RF4_ROCKET));
489 f5 &= ~(RF5_BALL_MASK);
490 f6 &= ~(RF6_BALL_MASK);
494 f4 &= ~(RF4_BIG_BALL_MASK);
495 f5 &= ~(RF5_BIG_BALL_MASK);
496 f6 &= ~(RF6_BIG_BALL_MASK);
499 else if (f5 & RF5_BA_LITE)
501 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))
502 f5 &= ~(RF5_BA_LITE);
511 get_project_point(target_ptr, m_ptr->fy, m_ptr->fx, &real_y, &real_x, PROJECT_STOP);
512 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))
516 if (((f4 & RF4_BEAM_MASK) || (f5 & RF5_BEAM_MASK) || (f6 & RF6_BEAM_MASK)) &&
517 !direct_beam(target_ptr, m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx, m_ptr))
519 f4 &= ~(RF4_BEAM_MASK);
520 f5 &= ~(RF5_BEAM_MASK);
521 f6 &= ~(RF6_BEAM_MASK);
524 if ((f4 & RF4_BREATH_MASK) || (f5 & RF5_BREATH_MASK) || (f6 & RF6_BREATH_MASK))
526 /* Expected breath radius */
527 POSITION rad = (r_ptr->flags2 & RF2_POWERFUL) ? 3 : 2;
529 if (!breath_direct(target_ptr, m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx, rad, 0, TRUE))
531 f4 &= ~(RF4_BREATH_MASK);
532 f5 &= ~(RF5_BREATH_MASK);
533 f6 &= ~(RF6_BREATH_MASK);
535 else if ((f4 & RF4_BR_LITE) &&
536 !breath_direct(target_ptr, m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx, rad, GF_LITE, TRUE))
538 f4 &= ~(RF4_BR_LITE);
540 else if ((f4 & RF4_BR_DISI) &&
541 !breath_direct(target_ptr, m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx, rad, GF_DISINTEGRATE, TRUE))
543 f4 &= ~(RF4_BR_DISI);
548 /* Special moves restriction */
549 if (f6 & RF6_SPECIAL)
551 if (m_ptr->r_idx == MON_ROLENTO)
553 if ((target_ptr->pet_extra_flags & (PF_ATTACK_SPELL | PF_SUMMON_SPELL)) != (PF_ATTACK_SPELL | PF_SUMMON_SPELL))
554 f6 &= ~(RF6_SPECIAL);
556 else if (r_ptr->d_char == 'B')
558 if ((target_ptr->pet_extra_flags & (PF_ATTACK_SPELL | PF_TELEPORT)) != (PF_ATTACK_SPELL | PF_TELEPORT))
559 f6 &= ~(RF6_SPECIAL);
561 else f6 &= ~(RF6_SPECIAL);
565 /* Remove some spells if necessary */
567 if (!(r_ptr->flags2 & RF2_STUPID))
569 /* Check for a clean bolt shot */
570 if (((f4 & RF4_BOLT_MASK) ||
571 (f5 & RF5_BOLT_MASK) ||
572 (f6 & RF6_BOLT_MASK)) &&
573 !clean_shot(target_ptr, m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx, pet))
575 f4 &= ~(RF4_BOLT_MASK);
576 f5 &= ~(RF5_BOLT_MASK);
577 f6 &= ~(RF6_BOLT_MASK);
580 /* Check for a possible summon */
581 if (((f4 & RF4_SUMMON_MASK) ||
582 (f5 & RF5_SUMMON_MASK) ||
583 (f6 & RF6_SUMMON_MASK)) &&
584 !(summon_possible(target_ptr, t_ptr->fy, t_ptr->fx)))
586 /* Remove summoning spells */
587 f4 &= ~(RF4_SUMMON_MASK);
588 f5 &= ~(RF5_SUMMON_MASK);
589 f6 &= ~(RF6_SUMMON_MASK);
593 if ((f4 & RF4_DISPEL) && !dispel_check_monster(target_ptr, m_idx, target_idx))
595 /* Remove dispel spell */
599 /* Check for a possible raise dead */
600 if ((f6 & RF6_RAISE_DEAD) && !raise_possible(target_ptr, m_ptr))
602 /* Remove raise dead spell */
603 f6 &= ~(RF6_RAISE_DEAD);
606 /* Special moves restriction */
607 if (f6 & RF6_SPECIAL)
609 if ((m_ptr->r_idx == MON_ROLENTO) && !summon_possible(target_ptr, t_ptr->fy, t_ptr->fx))
611 f6 &= ~(RF6_SPECIAL);
616 if (r_ptr->flags2 & RF2_SMART)
618 /* Hack -- allow "desperate" spells */
619 if ((m_ptr->hp < m_ptr->maxhp / 10) &&
620 (randint0(100) < 50))
622 /* Require intelligent spells */
623 f4 &= (RF4_INT_MASK);
624 f5 &= (RF5_INT_MASK);
625 f6 &= (RF6_INT_MASK);
628 /* Hack -- decline "teleport level" in some case */
629 if ((f6 & RF6_TELE_LEVEL) && is_teleport_level_ineffective(target_ptr, (target_idx == target_ptr->riding) ? 0 : target_idx))
631 f6 &= ~(RF6_TELE_LEVEL);
636 if (!f4 && !f5 && !f6) return FALSE;
638 /* Extract the "inate" spells */
639 for (k = 0; k < 32; k++)
641 if (f4 & (1L << k)) spell[num++] = k + RF4_SPELL_START;
644 /* Extract the "normal" spells */
645 for (k = 0; k < 32; k++)
647 if (f5 & (1L << k)) spell[num++] = k + RF5_SPELL_START;
650 /* Extract the "bizarre" spells */
651 for (k = 0; k < 32; k++)
653 if (f6 & (1L << k)) spell[num++] = k + RF6_SPELL_START;
657 if (!num) return FALSE;
659 /* Stop if player is dead or gone */
660 if (!target_ptr->playing || target_ptr->is_dead) return FALSE;
662 /* Handle "leaving" */
663 if (target_ptr->leaving) return FALSE;
665 /* Get the monster name (or "it") */
666 monster_desc(target_ptr, m_name, m_ptr, 0x00);
670 /* Get the monster possessive ("his"/"her"/"its") */
671 monster_desc(target_ptr, m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
674 /* Get the target's name (or "it") */
675 monster_desc(target_ptr, t_name, t_ptr, 0x00);
677 /* Choose a spell to cast */
678 thrown_spell = spell[randint0(num)];
680 if (target_ptr->riding && (m_idx == target_ptr->riding)) disturb(target_ptr, TRUE, TRUE);
682 /* Check for spell failure (inate attacks never fail) */
683 if (!spell_is_inate(thrown_spell) && (in_no_magic_dungeon || (MON_STUNNED(m_ptr) && one_in_(2))))
685 disturb(target_ptr, TRUE, TRUE);
686 if (see_m) msg_format(_("%^sは呪文を唱えようとしたが失敗した。",
687 "%^s tries to cast a spell, but fails."), m_name);
692 /* Hex: Anti Magic Barrier */
693 if (!spell_is_inate(thrown_spell) && magic_barrier(target_ptr, m_idx))
695 if (see_m) msg_format(_("反魔法バリアが%^sの呪文をかき消した。",
696 "Anti magic barrier cancels the spell which %^s casts."), m_name);
700 can_remember = is_original_ap_and_seen(target_ptr, m_ptr);
702 dam = monspell_to_monster(target_ptr, thrown_spell, y, x, m_idx, target_idx, FALSE);
703 if (dam < 0) return FALSE;
705 bool is_special_magic = m_ptr->ml;
706 is_special_magic &= maneable;
707 is_special_magic &= current_world_ptr->timewalk_m_idx == 0;
708 is_special_magic &= !target_ptr->blind;
709 is_special_magic &= target_ptr->pclass == CLASS_IMITATOR;
710 is_special_magic &= thrown_spell != 167; /* Not RF6_SPECIAL */
711 if (is_special_magic)
713 if (target_ptr->mane_num == MAX_MANE)
715 target_ptr->mane_num--;
716 for (int i = 0; i < target_ptr->mane_num - 1; i++)
718 target_ptr->mane_spell[i] = target_ptr->mane_spell[i + 1];
719 target_ptr->mane_dam[i] = target_ptr->mane_dam[i + 1];
723 target_ptr->mane_spell[target_ptr->mane_num] = thrown_spell - RF4_SPELL_START;
724 target_ptr->mane_dam[target_ptr->mane_num] = dam;
725 target_ptr->mane_num++;
726 target_ptr->new_mane = TRUE;
728 target_ptr->redraw |= PR_IMITATION;
731 /* Remember what the monster did, if we saw it */
735 if (thrown_spell < RF4_SPELL_START + RF4_SPELL_SIZE)
737 r_ptr->r_flags4 |= (1L << (thrown_spell - RF4_SPELL_START));
738 if (r_ptr->r_cast_spell < MAX_UCHAR) r_ptr->r_cast_spell++;
742 else if (thrown_spell < RF5_SPELL_START + RF5_SPELL_SIZE)
744 r_ptr->r_flags5 |= (1L << (thrown_spell - RF5_SPELL_START));
745 if (r_ptr->r_cast_spell < MAX_UCHAR) r_ptr->r_cast_spell++;
749 else if (thrown_spell < RF6_SPELL_START + RF6_SPELL_SIZE)
751 r_ptr->r_flags6 |= (1L << (thrown_spell - RF6_SPELL_START));
752 if (r_ptr->r_cast_spell < MAX_UCHAR) r_ptr->r_cast_spell++;
756 /* Always take note of monsters that kill you */
757 if (target_ptr->is_dead && (r_ptr->r_deaths < MAX_SHORT) && !floor_ptr->inside_arena)
759 r_ptr->r_deaths++; /* Ignore appearance difference */
762 /* A spell was cast */