*/
#include "angband.h"
+#include "util.h"
+
#include "cmd-pet.h"
-#include "monsterrace-hook.h"
#include "melee.h"
-#include "projection.h"
+#include "spells.h"
#include "spells-summon.h"
#include "quest.h"
#include "avatar.h"
#include "realm-hex.h"
+#include "object-flavor.h"
#include "object-hook.h"
#include "feature.h"
#include "grid.h"
#include "player-move.h"
#include "monster-status.h"
#include "monster-spell.h"
+#include "monster-process.h"
+#include "monsterrace-hook.h"
+#include "dungeon.h"
+#include "floor.h"
+#include "files.h"
/*!
{
if (p_ptr->inside_battle)
{
- start = randint1(m_max-1)+m_max;
+ start = randint1(current_floor_ptr->m_max-1)+current_floor_ptr->m_max;
if(randint0(2)) plus = -1;
}
- else start = m_max + 1;
+ else start = current_floor_ptr->m_max + 1;
/* Scan thru all monsters */
- for (i = start; ((i < start + m_max) && (i > start - m_max)); i+=plus)
+ for (i = start; ((i < start + current_floor_ptr->m_max) && (i > start - current_floor_ptr->m_max)); i+=plus)
{
- MONSTER_IDX dummy = (i % m_max);
+ MONSTER_IDX dummy = (i % current_floor_ptr->m_max);
if (!dummy) continue;
return TRUE;
}
-
-/*!
- * @brief モンスターが敵モンスターに行う打撃処理 /
- * Hack, based on mon_take_hit... perhaps all monster attacks on other monsters should use this?
- * @param m_idx 目標となるモンスターの参照ID
- * @param dam ダメージ量
- * @param dead 目標となったモンスターの死亡状態を返す参照ポインタ
- * @param fear 目標となったモンスターの恐慌状態を返す参照ポインタ
- * @param note 目標モンスターが死亡した場合の特別メッセージ(NULLならば標準表示を行う)
- * @param who 打撃を行ったモンスターの参照ID
- * @return なし
- */
-void mon_take_hit_mon(MONSTER_IDX m_idx, HIT_POINT dam, bool *dead, bool *fear, concptr note, MONSTER_IDX who)
-{
- monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx];
- monster_race *r_ptr = &r_info[m_ptr->r_idx];
- GAME_TEXT m_name[160];
- bool seen = is_seen(m_ptr);
-
- /* Can the player be aware of this attack? */
- bool known = (m_ptr->cdis <= MAX_SIGHT);
-
- /* Extract monster name */
- monster_desc(m_name, m_ptr, 0);
-
- /* Redraw (later) if needed */
- if (m_ptr->ml)
- {
- if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
- if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
- }
-
- (void)set_monster_csleep(m_idx, 0);
-
- if (p_ptr->riding && (m_idx == p_ptr->riding)) disturb(TRUE, TRUE);
-
- if (MON_INVULNER(m_ptr) && randint0(PENETRATE_INVULNERABILITY))
- {
- if (seen)
- {
- msg_format(_("%^sはダメージを受けない。", "%^s is unharmed."), m_name);
- }
- return;
- }
-
- if (r_ptr->flagsr & RFR_RES_ALL)
- {
- if(dam > 0)
- {
- dam /= 100;
- if((dam == 0) && one_in_(3)) dam = 1;
- }
- if(dam == 0)
- {
- if (seen)
- {
- msg_format(_("%^sはダメージを受けない。", "%^s is unharmed."), m_name);
- }
- return;
- }
- }
-
- /* Hurt it */
- m_ptr->hp -= dam;
-
- /* It is dead now... or is it? */
- if (m_ptr->hp < 0)
- {
- if (((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) ||
- (r_ptr->flags7 & RF7_NAZGUL)) &&
- !p_ptr->inside_battle)
- {
- m_ptr->hp = 1;
- }
- else
- {
- /* Make a sound */
- if (!monster_living(m_ptr->r_idx))
- {
- sound(SOUND_N_KILL);
- }
- else
- {
- sound(SOUND_KILL);
- }
-
- *dead = TRUE;
-
- if (known)
- {
- monster_desc(m_name, m_ptr, MD_TRUE_NAME);
- /* Unseen death by normal attack */
- if (!seen)
- {
- mon_fight = TRUE;
- }
- /* Death by special attack */
- else if (note)
- {
- msg_format(_("%^s%s", "%^s%s"), m_name, note);
- }
- /* Death by normal attack -- nonliving monster */
- else if (!monster_living(m_ptr->r_idx))
- {
- msg_format(_("%^sは破壊された。", "%^s is destroyed."), m_name);
- }
- /* Death by normal attack -- living monster */
- else
- {
- msg_format(_("%^sは殺された。", "%^s is killed."), m_name);
- }
- }
-
- monster_gain_exp(who, m_ptr->r_idx);
- monster_death(m_idx, FALSE);
- delete_monster_idx(m_idx);
-
- /* Not afraid */
- (*fear) = FALSE;
-
- /* Monster is dead */
- return;
- }
- }
-
- *dead = FALSE;
-
-#ifdef ALLOW_FEAR
-
- /* Mega-Hack -- Pain cancels fear */
- if (MON_MONFEAR(m_ptr) && (dam > 0))
- {
- /* Cure fear */
- if (set_monster_monfear(m_idx, MON_MONFEAR(m_ptr) - randint1(dam / 4)))
- {
- /* No more fear */
- (*fear) = FALSE;
- }
- }
-
- /* Sometimes a monster gets scared by damage */
- if (!MON_MONFEAR(m_ptr) && !(r_ptr->flags3 & RF3_NO_FEAR))
- {
- /* Percentage of fully healthy */
- int percentage = (100L * m_ptr->hp) / m_ptr->maxhp;
-
- /*
- * Run (sometimes) if at 10% or less of max hit points,
- * or (usually) when hit for half its current hit points
- */
- if (((percentage <= 10) && (randint0(10) < percentage)) ||
- ((dam >= m_ptr->hp) && (randint0(100) < 80)))
- {
- /* Hack -- note fear */
- (*fear) = TRUE;
-
- /* Hack -- Add some timed fear */
- (void)set_monster_monfear(m_idx, (randint1(10) +
- (((dam >= m_ptr->hp) && (percentage > 7)) ?
- 20 : ((11 - percentage) * 5))));
- }
- }
-
-#endif /* ALLOW_FEAR */
-
- if ((dam > 0) && !is_pet(m_ptr) && !is_friendly(m_ptr) && (who != m_idx))
- {
- if (is_pet(¤t_floor_ptr->m_list[who]) && !player_bold(m_ptr->target_y, m_ptr->target_x))
- {
- set_target(m_ptr, current_floor_ptr->m_list[who].fy, current_floor_ptr->m_list[who].fx);
- }
- }
-
- if (p_ptr->riding && (p_ptr->riding == m_idx) && (dam > 0))
- {
- /* Extract monster name */
- monster_desc(m_name, m_ptr, 0);
-
- if (m_ptr->hp > m_ptr->maxhp/3) dam = (dam + 1) / 2;
- if (rakuba((dam > 200) ? 200 : dam, FALSE))
- {
- msg_format(_("%^sに振り落とされた!", "You have thrown off from %s!"), m_name);
- }
- }
-
- /* Not dead yet */
- return;
-}
-
-
/*!
* @brief モンスターがプレイヤーから逃走するかどうかを返す /
* Returns whether a given monster will try to run from the player.
/* Process the monsters (backwards) */
- for (i = m_max - 1; i >= 1; i--)
+ for (i = current_floor_ptr->m_max - 1; i >= 1; i--)
{
/* Access the monster */
m_ptr = ¤t_floor_ptr->m_list[i];