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
21 #include "realm-hex.h"
22 #include "player-move.h"
23 #include "player-class.h"
25 #include "monster-status.h"
26 #include "monster-spell.h"
30 #include "view-mainwindow.h"
33 * @brief モンスターが敵対モンスターにビームを当てること可能かを判定する /
34 * Determine if a beam spell will hit the target.
35 * @param target_ptr プレーヤーへの参照ポインタ
40 * @param m_ptr 使用するモンスターの構造体参照ポインタ
41 * @return ビームが到達可能ならばTRUEを返す
43 static bool direct_beam(player_type *target_ptr, POSITION y1, POSITION x1, POSITION y2, POSITION x2, monster_type *m_ptr)
45 /* Check the projection path */
46 floor_type *floor_ptr = target_ptr->current_floor_ptr;
48 int grid_n = project_path(floor_ptr, grid_g, MAX_RANGE, y1, x1, y2, x2, PROJECT_THRU);
50 /* No grid is ever projectable from itself */
51 if (!grid_n) return FALSE;
55 bool is_friend = is_pet(m_ptr);
56 for (int i = 0; i < grid_n; i++)
58 y = GRID_Y(grid_g[i]);
59 x = GRID_X(grid_g[i]);
61 if (y == y2 && x == x2)
63 else if (is_friend && floor_ptr->grid_array[y][x].m_idx > 0 &&
64 !are_enemies(m_ptr, &floor_ptr->m_list[floor_ptr->grid_array[y][x].m_idx]))
66 /* Friends don't shoot friends */
70 if (is_friend && player_bold(target_ptr, y, x))
74 if (!hit2) return FALSE;
80 * @brief モンスターが敵対モンスターに直接ブレスを当てることが可能かを判定する /
81 * Determine if a breath will hit the target.
88 * @param is_friend TRUEならば、プレイヤーを巻き込む時にブレスの判定をFALSEにする。
89 * @return ブレスを直接当てられるならばTRUEを返す
91 static bool breath_direct(player_type *master_ptr, POSITION y1, POSITION x1, POSITION y2, POSITION x2, POSITION rad, EFFECT_ID typ, bool is_friend)
100 case GF_DISINTEGRATE:
108 /* Check the projection path */
110 int grid_n = project_path(master_ptr->current_floor_ptr, grid_g, MAX_RANGE, y1, x1, y2, x2, flg);
112 /* Project along the path */
116 for (i = 0; i < grid_n; ++i)
118 int ny = GRID_Y(grid_g[i]);
119 int nx = GRID_X(grid_g[i]);
121 if (flg & PROJECT_DISI)
123 /* Hack -- Balls explode before reaching walls */
124 if (cave_stop_disintegration(master_ptr->current_floor_ptr, ny, nx)) break;
126 else if (flg & PROJECT_LOS)
128 /* Hack -- Balls explode before reaching walls */
129 if (!cave_los_bold(master_ptr->current_floor_ptr, ny, nx)) break;
133 /* Hack -- Balls explode before reaching walls */
134 if (!cave_have_flag_bold(master_ptr->current_floor_ptr, ny, nx, FF_PROJECT)) break;
137 /* Save the "blast epicenter" */
148 if (flg & PROJECT_DISI)
150 if (in_disintegration_range(master_ptr->current_floor_ptr, y1, x1, y2, x2) && (distance(y1, x1, y2, x2) <= rad)) hit2 = TRUE;
151 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;
153 else if (flg & PROJECT_LOS)
155 if (los(master_ptr->current_floor_ptr, y1, x1, y2, x2) && (distance(y1, x1, y2, x2) <= rad)) hit2 = TRUE;
156 if (los(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;
160 if (projectable(master_ptr->current_floor_ptr, y1, x1, y2, x2) && (distance(y1, x1, y2, x2) <= rad)) hit2 = TRUE;
161 if (projectable(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;
167 POSITION gx[1024], gy[1024];
169 POSITION gm_rad = rad;
170 breath_shape(master_ptr->current_floor_ptr, grid_g, grid_n, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, y, x, typ);
172 for (i = 0; i < grids; i++)
176 if ((y == y2) && (x == x2)) hit2 = TRUE;
177 if (player_bold(master_ptr, y, x)) hityou = TRUE;
181 if (!hit2) return FALSE;
182 if (is_friend && hityou) return FALSE;
189 * @brief モンスターが特殊能力の目標地点を決める処理 /
190 * Get the actual center point of ball spells (rad > 1) (originally from TOband)
193 * @param ty 目標Y座標を返す参照ポインタ
194 * @param tx 目標X座標を返す参照ポインタ
195 * @param flg 判定のフラグ配列
198 void get_project_point(floor_type *floor_ptr, POSITION sy, POSITION sx, POSITION *ty, POSITION *tx, BIT_FLAGS flg)
201 int path_n = project_path(floor_ptr, path_g, MAX_RANGE, sy, sx, *ty, *tx, flg);
206 /* Project along the path */
207 for (int i = 0; i < path_n; i++)
209 sy = GRID_Y(path_g[i]);
210 sx = GRID_X(path_g[i]);
212 /* Hack -- Balls explode before reaching walls */
213 if (!cave_have_flag_bold(floor_ptr, sy, sx, FF_PROJECT)) break;
222 * @brief モンスターが敵モンスターに魔力消去を使うかどうかを返す /
223 * Check should monster cast dispel spell at other monster.
224 * @param target_ptr プレーヤーへの参照ポインタ
225 * @param m_idx 術者のモンスターID
226 * @param t_idx 目標のモンスターID
227 * @return 魔力消去を使うべきならばTRUEを変えす。
229 static bool dispel_check_monster(player_type *target_ptr, MONSTER_IDX m_idx, MONSTER_IDX t_idx)
231 monster_type *t_ptr = &target_ptr->current_floor_ptr->m_list[t_idx];
232 if (MON_INVULNER(t_ptr)) return TRUE;
234 if ((t_ptr->mspeed < 135) && MON_FAST(t_ptr)) return TRUE;
237 if ((t_idx == target_ptr->riding) && dispel_check(target_ptr, m_idx)) return TRUE;
239 /* No need to cast dispel spell */
245 * todo モンスターからモンスターへの呪文なのにplayer_typeが引数になり得るのは間違っている……
246 * @brief モンスターが敵モンスターに特殊能力を使う処理のメインルーチン /
247 * Monster tries to 'cast a spell' (or breath, etc) at another monster.
248 * @param target_ptr プレーヤーへの参照ポインタ
249 * @param m_idx 術者のモンスターID
250 * @return 実際に特殊能力を使った場合TRUEを返す
252 * The player is only disturbed if able to be affected by the spell.
254 bool monst_spell_monst(player_type *target_ptr, MONSTER_IDX m_idx)
256 POSITION y = 0, x = 0;
258 MONSTER_IDX target_idx = 0;
264 byte spell[96], num = 0;
266 GAME_TEXT m_name[160];
267 GAME_TEXT t_name[160];
273 floor_type *floor_ptr = target_ptr->current_floor_ptr;
274 monster_type *m_ptr = &floor_ptr->m_list[m_idx];
275 monster_type *t_ptr = NULL;
277 monster_race *r_ptr = &r_info[m_ptr->r_idx];
279 bool see_m = is_seen(m_ptr);
280 bool maneable = player_has_los_bold(target_ptr, m_ptr->fy, m_ptr->fx);
281 bool pet = is_pet(m_ptr);
283 bool in_no_magic_dungeon = (d_info[target_ptr->dungeon_idx].flags1 & DF1_NO_MAGIC) && floor_ptr->dun_level
284 && (!floor_ptr->inside_quest || is_fixed_quest_idx(floor_ptr->inside_quest));
286 bool can_use_lite_area = FALSE;
289 /* Cannot cast spells when confused */
290 if (MON_CONFUSED(m_ptr)) return FALSE;
292 /* Extract the racial spell flags */
293 BIT_FLAGS f4 = r_ptr->flags4;
294 BIT_FLAGS f5 = r_ptr->a_ability_flags1;
295 BIT_FLAGS f6 = r_ptr->a_ability_flags2;
297 /* Target is given for pet? */
298 if (target_ptr->pet_t_m_idx && pet)
300 target_idx = target_ptr->pet_t_m_idx;
301 t_ptr = &floor_ptr->m_list[target_idx];
303 /* Cancel if not projectable (for now) */
304 if ((m_idx == target_idx) || !projectable(floor_ptr, m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx))
310 /* Is there counter attack target? */
311 if (!target_idx && m_ptr->target_y)
313 target_idx = floor_ptr->grid_array[m_ptr->target_y][m_ptr->target_x].m_idx;
317 t_ptr = &floor_ptr->m_list[target_idx];
319 /* Cancel if neither enemy nor a given target */
320 if ((m_idx == target_idx) ||
321 ((target_idx != target_ptr->pet_t_m_idx) && !are_enemies(m_ptr, t_ptr)))
326 /* Allow only summoning etc.. if not projectable */
327 else if (!projectable(floor_ptr, m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx))
329 f4 &= (RF4_INDIRECT_MASK);
330 f5 &= (RF5_INDIRECT_MASK);
331 f6 &= (RF6_INDIRECT_MASK);
336 /* Look for enemies normally */
339 bool success = FALSE;
341 if (target_ptr->phase_out)
343 start = randint1(floor_ptr->m_max-1) + floor_ptr->m_max;
344 if (randint0(2)) plus = -1;
346 else start = floor_ptr->m_max + 1;
348 /* Scan thru all monsters */
349 for (int i = start; ((i < start + floor_ptr->m_max) && (i > start - floor_ptr->m_max)); i += plus)
351 MONSTER_IDX dummy = (i % floor_ptr->m_max);
352 if (!dummy) continue;
355 t_ptr = &floor_ptr->m_list[target_idx];
357 if (!monster_is_valid(t_ptr)) continue;
359 /* Monster must be 'an enemy' */
360 if ((m_idx == target_idx) || !are_enemies(m_ptr, t_ptr)) continue;
362 /* Monster must be projectable */
363 if (!projectable(floor_ptr, m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx)) continue;
371 if (!success) return FALSE;
374 /* OK -- we've got a target */
378 /* Forget old counter attack target */
381 /* Remove unimplemented spells */
382 f6 &= ~(RF6_WORLD | RF6_TRAPS | RF6_FORGET);
384 if (f4 & RF4_BR_LITE)
386 if (!los(floor_ptr, m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx))
387 f4 &= ~(RF4_BR_LITE);
390 /* Remove unimplemented special moves */
391 if (f6 & RF6_SPECIAL)
393 if ((m_ptr->r_idx != MON_ROLENTO) && (r_ptr->d_char != 'B'))
394 f6 &= ~(RF6_SPECIAL);
397 if (f6 & RF6_DARKNESS)
399 bool vs_ninja = (target_ptr->pclass == CLASS_NINJA) && !is_hostile(t_ptr);
402 !(r_ptr->flags3 & (RF3_UNDEAD | RF3_HURT_LITE)) &&
403 !(r_ptr->flags7 & RF7_DARK_MASK))
404 can_use_lite_area = TRUE;
406 if (!(r_ptr->flags2 & RF2_STUPID))
408 if (d_info[target_ptr->dungeon_idx].flags1 & DF1_DARKNESS) f6 &= ~(RF6_DARKNESS);
409 else if (vs_ninja && !can_use_lite_area) f6 &= ~(RF6_DARKNESS);
413 if (in_no_magic_dungeon && !(r_ptr->flags2 & RF2_STUPID))
415 f4 &= (RF4_NOMAGIC_MASK);
416 f5 &= (RF5_NOMAGIC_MASK);
417 f6 &= (RF6_NOMAGIC_MASK);
420 if (floor_ptr->inside_arena || target_ptr->phase_out)
422 f4 &= ~(RF4_SUMMON_MASK);
423 f5 &= ~(RF5_SUMMON_MASK);
424 f6 &= ~(RF6_SUMMON_MASK | RF6_TELE_LEVEL);
426 if (m_ptr->r_idx == MON_ROLENTO) f6 &= ~(RF6_SPECIAL);
429 if (target_ptr->phase_out && !one_in_(3))
434 if (m_idx == target_ptr->riding)
436 f4 &= ~(RF4_RIDING_MASK);
437 f5 &= ~(RF5_RIDING_MASK);
438 f6 &= ~(RF6_RIDING_MASK);
444 f6 &= ~(RF6_DARKNESS | RF6_TRAPS);
446 if (!(target_ptr->pet_extra_flags & PF_TELEPORT))
448 f6 &= ~(RF6_BLINK | RF6_TPORT | RF6_TELE_TO | RF6_TELE_AWAY | RF6_TELE_LEVEL);
451 if (!(target_ptr->pet_extra_flags & PF_ATTACK_SPELL))
453 f4 &= ~(RF4_ATTACK_MASK);
454 f5 &= ~(RF5_ATTACK_MASK);
455 f6 &= ~(RF6_ATTACK_MASK);
458 if (!(target_ptr->pet_extra_flags & PF_SUMMON_SPELL))
460 f4 &= ~(RF4_SUMMON_MASK);
461 f5 &= ~(RF5_SUMMON_MASK);
462 f6 &= ~(RF6_SUMMON_MASK);
465 /* Prevent collateral damage */
466 if (!(target_ptr->pet_extra_flags & PF_BALL_SPELL) && (m_idx != target_ptr->riding))
468 if ((f4 & (RF4_BALL_MASK & ~(RF4_ROCKET))) ||
469 (f5 & RF5_BALL_MASK) ||
470 (f6 & RF6_BALL_MASK))
475 get_project_point(floor_ptr, m_ptr->fy, m_ptr->fx, &real_y, &real_x, 0L);
477 if (projectable(floor_ptr, real_y, real_x, target_ptr->y, target_ptr->x))
479 int dist = distance(real_y, real_x, target_ptr->y, target_ptr->x);
483 f4 &= ~(RF4_BALL_MASK & ~(RF4_ROCKET));
484 f5 &= ~(RF5_BALL_MASK);
485 f6 &= ~(RF6_BALL_MASK);
489 f4 &= ~(RF4_BIG_BALL_MASK);
490 f5 &= ~(RF5_BIG_BALL_MASK);
491 f6 &= ~(RF6_BIG_BALL_MASK);
494 else if (f5 & RF5_BA_LITE)
496 if ((distance(real_y, real_x, target_ptr->y, target_ptr->x) <= 4) && los(floor_ptr, real_y, real_x, target_ptr->y, target_ptr->x))
497 f5 &= ~(RF5_BA_LITE);
506 get_project_point(floor_ptr, m_ptr->fy, m_ptr->fx, &real_y, &real_x, PROJECT_STOP);
507 if (projectable(floor_ptr, real_y, real_x, target_ptr->y, target_ptr->x) && (distance(real_y, real_x, target_ptr->y, target_ptr->x) <= 2))
511 if (((f4 & RF4_BEAM_MASK) || (f5 & RF5_BEAM_MASK) || (f6 & RF6_BEAM_MASK)) &&
512 !direct_beam(target_ptr, m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx, m_ptr))
514 f4 &= ~(RF4_BEAM_MASK);
515 f5 &= ~(RF5_BEAM_MASK);
516 f6 &= ~(RF6_BEAM_MASK);
519 if ((f4 & RF4_BREATH_MASK) || (f5 & RF5_BREATH_MASK) || (f6 & RF6_BREATH_MASK))
521 /* Expected breath radius */
522 POSITION rad = (r_ptr->flags2 & RF2_POWERFUL) ? 3 : 2;
524 if (!breath_direct(target_ptr, m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx, rad, 0, TRUE))
526 f4 &= ~(RF4_BREATH_MASK);
527 f5 &= ~(RF5_BREATH_MASK);
528 f6 &= ~(RF6_BREATH_MASK);
530 else if ((f4 & RF4_BR_LITE) &&
531 !breath_direct(target_ptr, m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx, rad, GF_LITE, TRUE))
533 f4 &= ~(RF4_BR_LITE);
535 else if ((f4 & RF4_BR_DISI) &&
536 !breath_direct(target_ptr, m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx, rad, GF_DISINTEGRATE, TRUE))
538 f4 &= ~(RF4_BR_DISI);
543 /* Special moves restriction */
544 if (f6 & RF6_SPECIAL)
546 if (m_ptr->r_idx == MON_ROLENTO)
548 if ((target_ptr->pet_extra_flags & (PF_ATTACK_SPELL | PF_SUMMON_SPELL)) != (PF_ATTACK_SPELL | PF_SUMMON_SPELL))
549 f6 &= ~(RF6_SPECIAL);
551 else if (r_ptr->d_char == 'B')
553 if ((target_ptr->pet_extra_flags & (PF_ATTACK_SPELL | PF_TELEPORT)) != (PF_ATTACK_SPELL | PF_TELEPORT))
554 f6 &= ~(RF6_SPECIAL);
556 else f6 &= ~(RF6_SPECIAL);
560 /* Remove some spells if necessary */
562 if (!(r_ptr->flags2 & RF2_STUPID))
564 /* Check for a clean bolt shot */
565 if (((f4 & RF4_BOLT_MASK) ||
566 (f5 & RF5_BOLT_MASK) ||
567 (f6 & RF6_BOLT_MASK)) &&
568 !clean_shot(target_ptr, m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx, pet))
570 f4 &= ~(RF4_BOLT_MASK);
571 f5 &= ~(RF5_BOLT_MASK);
572 f6 &= ~(RF6_BOLT_MASK);
575 /* Check for a possible summon */
576 if (((f4 & RF4_SUMMON_MASK) ||
577 (f5 & RF5_SUMMON_MASK) ||
578 (f6 & RF6_SUMMON_MASK)) &&
579 !(summon_possible(floor_ptr, t_ptr->fy, t_ptr->fx)))
581 /* Remove summoning spells */
582 f4 &= ~(RF4_SUMMON_MASK);
583 f5 &= ~(RF5_SUMMON_MASK);
584 f6 &= ~(RF6_SUMMON_MASK);
588 if ((f4 & RF4_DISPEL) && !dispel_check_monster(target_ptr, m_idx, target_idx))
590 /* Remove dispel spell */
594 /* Check for a possible raise dead */
595 if ((f6 & RF6_RAISE_DEAD) && !raise_possible(floor_ptr, m_ptr))
597 /* Remove raise dead spell */
598 f6 &= ~(RF6_RAISE_DEAD);
601 /* Special moves restriction */
602 if (f6 & RF6_SPECIAL)
604 if ((m_ptr->r_idx == MON_ROLENTO) && !summon_possible(floor_ptr, t_ptr->fy, t_ptr->fx))
606 f6 &= ~(RF6_SPECIAL);
611 if (r_ptr->flags2 & RF2_SMART)
613 /* Hack -- allow "desperate" spells */
614 if ((m_ptr->hp < m_ptr->maxhp / 10) &&
615 (randint0(100) < 50))
617 /* Require intelligent spells */
618 f4 &= (RF4_INT_MASK);
619 f5 &= (RF5_INT_MASK);
620 f6 &= (RF6_INT_MASK);
623 /* Hack -- decline "teleport level" in some case */
624 if ((f6 & RF6_TELE_LEVEL) && is_teleport_level_ineffective(target_ptr, (target_idx == target_ptr->riding) ? 0 : target_idx))
626 f6 &= ~(RF6_TELE_LEVEL);
631 if (!f4 && !f5 && !f6) return FALSE;
633 /* Extract the "inate" spells */
634 for (k = 0; k < 32; k++)
636 if (f4 & (1L << k)) spell[num++] = k + RF4_SPELL_START;
639 /* Extract the "normal" spells */
640 for (k = 0; k < 32; k++)
642 if (f5 & (1L << k)) spell[num++] = k + RF5_SPELL_START;
645 /* Extract the "bizarre" spells */
646 for (k = 0; k < 32; k++)
648 if (f6 & (1L << k)) spell[num++] = k + RF6_SPELL_START;
652 if (!num) return FALSE;
654 /* Stop if player is dead or gone */
655 if (!target_ptr->playing || target_ptr->is_dead) return FALSE;
657 /* Handle "leaving" */
658 if (target_ptr->leaving) return FALSE;
660 /* Get the monster name (or "it") */
661 monster_desc(m_name, m_ptr, 0x00);
664 /* Get the monster possessive ("his"/"her"/"its") */
665 monster_desc(m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
668 /* Get the target's name (or "it") */
669 monster_desc(t_name, t_ptr, 0x00);
671 /* Choose a spell to cast */
672 thrown_spell = spell[randint0(num)];
674 if (target_ptr->riding && (m_idx == target_ptr->riding)) disturb(target_ptr, TRUE, TRUE);
676 /* Check for spell failure (inate attacks never fail) */
677 if (!spell_is_inate(thrown_spell) && (in_no_magic_dungeon || (MON_STUNNED(m_ptr) && one_in_(2))))
679 disturb(target_ptr, TRUE, TRUE);
680 if (see_m) msg_format(_("%^sは呪文を唱えようとしたが失敗した。",
681 "%^s tries to cast a spell, but fails."), m_name);
686 /* Hex: Anti Magic Barrier */
687 if (!spell_is_inate(thrown_spell) && magic_barrier(target_ptr, m_idx))
689 if (see_m) msg_format(_("反魔法バリアが%^sの呪文をかき消した。",
690 "Anti magic barrier cancels the spell which %^s casts."), m_name);
694 can_remember = is_original_ap_and_seen(m_ptr);
696 dam = monspell_to_monster(target_ptr, thrown_spell, y, x, m_idx, target_idx);
697 if (dam < 0) return FALSE;
699 bool is_special_magic = m_ptr->ml;
700 is_special_magic &= maneable;
701 is_special_magic &= current_world_ptr->timewalk_m_idx == 0;
702 is_special_magic &= !target_ptr->blind;
703 is_special_magic &= target_ptr->pclass == CLASS_IMITATOR;
704 is_special_magic &= thrown_spell != 167; /* Not RF6_SPECIAL */
705 if (is_special_magic)
707 if (target_ptr->mane_num == MAX_MANE)
709 target_ptr->mane_num--;
710 for (int i = 0; i < target_ptr->mane_num - 1; i++)
712 target_ptr->mane_spell[i] = target_ptr->mane_spell[i + 1];
713 target_ptr->mane_dam[i] = target_ptr->mane_dam[i + 1];
717 target_ptr->mane_spell[target_ptr->mane_num] = thrown_spell - RF4_SPELL_START;
718 target_ptr->mane_dam[target_ptr->mane_num] = dam;
719 target_ptr->mane_num++;
720 target_ptr->new_mane = TRUE;
722 target_ptr->redraw |= PR_IMITATION;
725 /* Remember what the monster did, if we saw it */
729 if (thrown_spell < RF4_SPELL_START + RF4_SPELL_SIZE)
731 r_ptr->r_flags4 |= (1L << (thrown_spell - RF4_SPELL_START));
732 if (r_ptr->r_cast_spell < MAX_UCHAR) r_ptr->r_cast_spell++;
736 else if (thrown_spell < RF5_SPELL_START + RF5_SPELL_SIZE)
738 r_ptr->r_flags5 |= (1L << (thrown_spell - RF5_SPELL_START));
739 if (r_ptr->r_cast_spell < MAX_UCHAR) r_ptr->r_cast_spell++;
743 else if (thrown_spell < RF6_SPELL_START + RF6_SPELL_SIZE)
745 r_ptr->r_flags6 |= (1L << (thrown_spell - RF6_SPELL_START));
746 if (r_ptr->r_cast_spell < MAX_UCHAR) r_ptr->r_cast_spell++;
750 /* Always take note of monsters that kill you */
751 if (target_ptr->is_dead && (r_ptr->r_deaths < MAX_SHORT) && !floor_ptr->inside_arena)
753 r_ptr->r_deaths++; /* Ignore appearance difference */
756 /* A spell was cast */