*/
#include "angband.h"
+#include "cmd-pet.h"
+#include "monster-hook.h"
+#include "monster-status.h"
#define HORDE_NOGOOD 0x01 /*!< (未実装フラグ)HORDE生成でGOODなモンスターの生成を禁止する? */
#define HORDE_NOEVIL 0x02 /*!< (未実装フラグ)HORDE生成でEVILなモンスターの生成を禁止する? */
* @param x 目標x座標
* @return なし
*/
-void set_target(monster_type *m_ptr, int y, int x)
+void set_target(monster_type *m_ptr, POSITION y, POSITION x)
{
m_ptr->target_y = y;
m_ptr->target_x = x;
*/
void delete_monster_idx(MONSTER_IDX i)
{
- int x, y;
-
+ POSITION x, y;
monster_type *m_ptr = &m_list[i];
-
monster_race *r_ptr = &r_info[m_ptr->r_idx];
-
- s16b this_o_idx, next_o_idx = 0;
-
+ OBJECT_IDX this_o_idx, next_o_idx = 0;
/* Get location */
y = m_ptr->fy;
x = m_ptr->fx;
-
/* Hack -- Reduce the racial counter */
real_r_ptr(m_ptr)->cur_num--;
for (this_o_idx = m_ptr->hold_o_idx; this_o_idx; this_o_idx = next_o_idx)
{
object_type *o_ptr;
-
- /* Acquire object */
o_ptr = &o_list[this_o_idx];
/* Acquire next object */
* to prevent calling lite_spot()
*/
- /* Delete the object */
delete_object_idx(this_o_idx);
}
*/
static void compact_monsters_aux(IDX i1, IDX i2)
{
- int y, x, i;
-
+ POSITION y, x;
+ int i;
cave_type *c_ptr;
-
monster_type *m_ptr;
-
- s16b this_o_idx, next_o_idx = 0;
-
+ OBJECT_IDX this_o_idx, next_o_idx = 0;
/* Do nothing */
if (i1 == i2) return;
-
/* Old monster */
m_ptr = &m_list[i1];
- /* Location */
y = m_ptr->fy;
x = m_ptr->fx;
for (this_o_idx = m_ptr->hold_o_idx; this_o_idx; this_o_idx = next_o_idx)
{
object_type *o_ptr;
-
- /* Acquire object */
o_ptr = &o_list[this_o_idx];
/* Acquire next object */
if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
{
char m_name[80];
-
monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_COMPACT, m_name);
}
- /* Delete the monster */
delete_monster_idx(i);
/* Count the monster */
{
MONSTER_IDX i;
-
/* Normal allocation */
if (m_max < max_m_idx)
{
return (i);
}
-
/* Recycle dead monsters */
for (i = 1; i < m_max; i++)
{
return (i);
}
-
/* Warn the player (except during dungeon creation) */
if (character_dungeon) msg_print(_("モンスターが多すぎる!", "Too many monsters!"));
break;
}
}
-
- /* Result */
/* Since okay is int, "return (okay);" is not correct. */
return (bool)(okay ? TRUE : FALSE);
}
/* Keep the "best" one */
if (table[i].level < table[j].level) i = j;
}
-
- /* Result */
return (table[i].index);
}
* MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE
* --> Reflexive, genderized if visable ("himself") or "itself"
*/
-void monster_desc(char *desc, monster_type *m_ptr, int mode)
+void monster_desc(char *desc, monster_type *m_ptr, BIT_FLAGS mode)
{
cptr res;
monster_race *r_ptr;
/* Update monster recall window */
if (p_ptr->monster_race_idx == r_idx)
{
- /* Window stuff */
p_ptr->window |= (PW_MONSTER);
}
/* Update monster recall window */
if (p_ptr->monster_race_idx == m_ptr->r_idx)
{
- /* Window stuff */
p_ptr->window |= (PW_MONSTER);
}
}
*/
void sanity_blast(monster_type *m_ptr, bool necro)
{
- bool happened = FALSE;
int power = 100;
if (p_ptr->inside_battle || !character_dungeon) return;
}
else power *= 2;
- if (!hack_mind)
+ if (!is_loading_now)
return; /* No effect yet, just loaded... */
if (!m_ptr->ml)
return; /* Cannot see it for some reason */
if (!(r_ptr->flags2 & RF2_ELDRITCH_HORROR))
- return; /* oops */
+ return;
if (is_pet(m_ptr))
return; /* Pet eldritch horrors are safe most of the time */
msg_print(_("ネクロノミコンを読んで正気を失った!", "Your sanity is shaken by reading the Necronomicon!"));
}
- if (!saving_throw(p_ptr->skill_sav - power)) /* Mind blast */
+ if (saving_throw(p_ptr->skill_sav - power))
{
- if (!p_ptr->resist_conf)
- {
- (void)set_confused(p_ptr->confused + randint0(4) + 4);
- }
- if (!p_ptr->resist_chaos && one_in_(3))
- {
- (void)set_image(p_ptr->image + randint0(250) + 150);
- }
return;
}
- if (!saving_throw(p_ptr->skill_sav - power)) /* Lose int & wis */
- {
- do_dec_stat(A_INT);
- do_dec_stat(A_WIS);
- return;
- }
+ do {
+ (void)do_dec_stat(A_INT);
+ } while (randint0(100) > p_ptr->skill_sav && one_in_(2));
+
+ do {
+ (void)do_dec_stat(A_WIS);
+ } while (randint0(100) > p_ptr->skill_sav && one_in_(2));
- if (!saving_throw(p_ptr->skill_sav - power)) /* Brain smash */
+ switch (randint1(21))
{
+ case 1:
+ if (!(p_ptr->muta3 & MUT3_MORONIC) && one_in_(5))
+ {
+ if ((p_ptr->stat_use[A_INT] < 4) && (p_ptr->stat_use[A_WIS] < 4))
+ {
+ msg_print(_("あなたは完璧な馬鹿になったような気がした。しかしそれは元々だった。", "You turn into an utter moron!"));
+ }
+ else
+ {
+ msg_print(_("あなたは完璧な馬鹿になった!", "You turn into an utter moron!"));
+ }
+
+ if (p_ptr->muta3 & MUT3_HYPER_INT)
+ {
+ msg_print(_("あなたの脳は生体コンピュータではなくなった。", "Your brain is no longer a living computer."));
+ p_ptr->muta3 &= ~(MUT3_HYPER_INT);
+ }
+ p_ptr->muta3 |= MUT3_MORONIC;
+ }
+ break;
+ case 2:
+ case 3:
+ case 4:
+ if (!(p_ptr->muta2 & MUT2_COWARDICE) && !p_ptr->resist_fear)
+ {
+ msg_print(_("あなたはパラノイアになった!", "You become paranoid!"));
+
+ /* Duh, the following should never happen, but anyway... */
+ if (p_ptr->muta3 & MUT3_FEARLESS)
+ {
+ msg_print(_("あなたはもう恐れ知らずではなくなった。", "You are no longer fearless."));
+ p_ptr->muta3 &= ~(MUT3_FEARLESS);
+ }
+
+ p_ptr->muta2 |= MUT2_COWARDICE;
+ }
+ break;
+ case 5:
+ case 6:
+ case 7:
+ if (!(p_ptr->muta2 & MUT2_HALLU) && !p_ptr->resist_chaos)
+ {
+ msg_print(_("幻覚をひき起こす精神錯乱に陥った!", "You are afflicted by a hallucinatory insanity!"));
+ p_ptr->muta2 |= MUT2_HALLU;
+ }
+ break;
+ case 8:
+ case 9:
+ case 10:
+ if (!(p_ptr->muta2 & MUT2_BERS_RAGE))
+ {
+ msg_print(_("激烈な感情の発作におそわれるようになった!", "You become subject to fits of berserk rage!"));
+ p_ptr->muta2 |= MUT2_BERS_RAGE;
+ }
+ break;
+ case 11:
+ case 12:
+ case 13:
+ case 14:
+ case 15:
+ case 16:
+ /* Brain smash */
if (!p_ptr->resist_conf)
{
(void)set_confused(p_ptr->confused + randint0(4) + 4);
{
(void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
}
- while (randint0(100) > p_ptr->skill_sav)
- (void)do_dec_stat(A_INT);
- while (randint0(100) > p_ptr->skill_sav)
- (void)do_dec_stat(A_WIS);
if (!p_ptr->resist_chaos)
{
(void)set_image(p_ptr->image + randint0(250) + 150);
}
- return;
- }
-
- if (!saving_throw(p_ptr->skill_sav - power)) /* Amnesia */
- {
-
+ break;
+ case 17:
+ case 18:
+ case 19:
+ case 20:
+ case 21:
+ /* Amnesia */
if (lose_all_info())
msg_print(_("あまりの恐怖に全てのことを忘れてしまった!", "You forget everything in your utmost terror!"));
-
- return;
- }
-
- if (saving_throw(p_ptr->skill_sav - power))
- {
- return;
- }
-
- /* Else gain permanent insanity */
- if ((p_ptr->muta3 & MUT3_MORONIC) && /*(p_ptr->muta2 & MUT2_BERS_RAGE) &&*/
- ((p_ptr->muta2 & MUT2_COWARDICE) || (p_ptr->resist_fear)) &&
- ((p_ptr->muta2 & MUT2_HALLU) || (p_ptr->resist_chaos)))
- {
- /* The poor bastard already has all possible insanities! */
- return;
- }
-
- while (!happened)
- {
- switch (randint1(21))
- {
- case 1:
- if (!(p_ptr->muta3 & MUT3_MORONIC) && one_in_(5))
- {
- if ((p_ptr->stat_use[A_INT] < 4) && (p_ptr->stat_use[A_WIS] < 4))
- {
- msg_print(_("あなたは完璧な馬鹿になったような気がした。しかしそれは元々だった。", "You turn into an utter moron!"));
- }
- else
- {
- msg_print(_("あなたは完璧な馬鹿になった!", "You turn into an utter moron!"));
- }
-
- if (p_ptr->muta3 & MUT3_HYPER_INT)
- {
- msg_print(_("あなたの脳は生体コンピュータではなくなった。", "Your brain is no longer a living computer."));
- p_ptr->muta3 &= ~(MUT3_HYPER_INT);
- }
- p_ptr->muta3 |= MUT3_MORONIC;
- happened = TRUE;
- }
- break;
- case 2:
- case 3:
- case 4:
- case 5:
- case 6:
- case 7:
- case 8:
- case 9:
- case 10:
- case 11:
- if (!(p_ptr->muta2 & MUT2_COWARDICE) && !p_ptr->resist_fear)
- {
- msg_print(_("あなたはパラノイアになった!", "You become paranoid!"));
-
- /* Duh, the following should never happen, but anyway... */
- if (p_ptr->muta3 & MUT3_FEARLESS)
- {
- msg_print(_("あなたはもう恐れ知らずではなくなった。", "You are no longer fearless."));
- p_ptr->muta3 &= ~(MUT3_FEARLESS);
- }
-
- p_ptr->muta2 |= MUT2_COWARDICE;
- happened = TRUE;
- }
- break;
- case 12:
- case 13:
- case 14:
- case 15:
- case 16:
- case 17:
- case 18:
- case 19:
- case 20:
- case 21:
- if (!(p_ptr->muta2 & MUT2_HALLU) && !p_ptr->resist_chaos)
- {
- msg_print(_("幻覚をひき起こす精神錯乱に陥った!", "You are afflicted by a hallucinatory insanity!"));
- p_ptr->muta2 |= MUT2_HALLU;
- happened = TRUE;
- }
- break;
- default:
- if (!(p_ptr->muta2 & MUT2_BERS_RAGE))
- {
- msg_print(_("激烈な感情の発作におそわれるようになった!", "You become subject to fits of berserk rage!"));
- p_ptr->muta2 |= MUT2_BERS_RAGE;
- happened = TRUE;
- }
- break;
- }
+ break;
}
p_ptr->update |= PU_BONUS;
* "disturb_near" (monster which is "easily" viewable moves in some
* way). Note that "moves" includes "appears" and "disappears".
*/
-void update_mon(MONSTER_IDX m_idx, bool full)
+void update_monster(MONSTER_IDX m_idx, bool full)
{
monster_type *m_ptr = &m_list[m_idx];
if (disturb_near && (projectable(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x) && projectable(p_ptr->y, p_ptr->x, m_ptr->fy, m_ptr->fx)))
{
if (disturb_pets || is_hostile(m_ptr))
- disturb(1, 1);
+ disturb(TRUE, TRUE);
}
}
}
if (do_disturb)
{
if (disturb_pets || is_hostile(m_ptr))
- disturb(1, 1);
+ disturb(TRUE, TRUE);
}
}
}
if (do_disturb)
{
if (disturb_pets || is_hostile(m_ptr))
- disturb(1, 1);
+ disturb(TRUE, TRUE);
}
}
}
if (do_disturb)
{
if (disturb_pets || is_hostile(m_ptr))
- disturb(1, 1);
+ disturb(TRUE, TRUE);
}
}
}
/* Skip dead monsters */
if (!m_ptr->r_idx) continue;
-
- /* Update the monster */
- update_mon(i, full);
+ update_monster(i, full);
}
}
if (!r_idx)
{
- int level;
+ DEPTH level;
chameleon_change_m_idx = m_idx;
if (old_unique)
m_ptr->r_idx = r_idx;
m_ptr->ap_r_idx = r_idx;
- update_mon(m_idx, FALSE);
+ update_monster(m_idx, FALSE);
lite_spot(m_ptr->fy, m_ptr->fx);
if ((r_info[old_r_idx].flags7 & (RF7_LITE_MASK | RF7_DARK_MASK)) ||
*
* This routine refuses to place out-of-depth "FORCE_DEPTH" monsters.
*
- * XXX XXX XXX Use special "here" and "dead" flags for unique monsters,
+ * Use special "here" and "dead" flags for unique monsters,
* remove old "cur_num" and "max_num" fields.
*
- * XXX XXX XXX Actually, do something similar for artifacts, to simplify
+ * Actually, do something similar for artifacts, to simplify
* the "preserve" mode, and to make the "what artifacts" flag more useful.
*
* This is the only function which may place a monster in the dungeon,
c_ptr->info &= ~(CAVE_OBJECT);
c_ptr->mimic = 0;
- /* Notice */
note_spot(y, x);
}
else return FALSE;
p_ptr->update |= (PU_MON_LITE);
else if ((r_ptr->flags7 & RF7_HAS_LD_MASK) && !MON_CSLEEP(m_ptr))
p_ptr->update |= (PU_MON_LITE);
-
- /* Update the monster */
- update_mon(c_ptr->m_idx, TRUE);
+ update_monster(c_ptr->m_idx, TRUE);
/* Count the monsters on the level */
return TRUE;
}
-#define GROUP_MAX 32 /*!< place_monster_group() 関数によるモンスターのGROUP生成時の配置最大数 / Maximum size of a group of monsters */
-
/*!
* @brief モンスターを目標地点に集団生成する / Attempt to place a "group" of monsters around the given location
* @param who 召喚主のモンスター情報ID
if ((r_ptr->flags7 & RF7_CHAMELEON) && !(z_ptr->flags7 & RF7_CHAMELEON))
return FALSE;
- /* Okay */
return (TRUE);
}
/* Attempt to place the monster */
if (place_monster_aux(0, y, x, r_idx, mode)) return (TRUE);
- /* Oops */
return (FALSE);
}
-
-#ifdef MONSTER_HORDES
-
/*!
* @brief 指定地点に1種類のモンスター種族による群れを生成する
* @param y 生成地点y座標
return TRUE;
}
-#endif /* MONSTER_HORDES */
-
-
/*!
* @brief ダンジョンの主生成を試みる / Put the Guardian
* @param def_val 現在の主の生成状態
* Use "slp" to choose the initial "sleep" status
* Use "monster_level" for the monster level
*/
-bool alloc_monster(int dis, BIT_FLAGS mode)
+bool alloc_monster(POSITION dis, BIT_FLAGS mode)
{
- int y = 0, x = 0;
- int attempts_left = 10000;
+ int y = 0, x = 0;
+ int attempts_left = 10000;
/* Put the Guardian */
if (alloc_guardian(FALSE)) return TRUE;
}
-#ifdef MONSTER_HORDES
if (randint1(5000) <= dun_level)
{
if (alloc_horde(y, x))
}
else
{
-#endif /* MONSTER_HORDES */
-
/* Attempt to place the monster, allow groups */
if (place_monster(y, x, (mode | PM_ALLOW_GROUP))) return (TRUE);
-
-#ifdef MONSTER_HORDES
}
-#endif /* MONSTER_HORDES */
- /* Nope */
return (FALSE);
}
}
}
+ if (!summon_unique_okay && ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))) return FALSE;
+
/* Hack -- no specific type specified */
if (!summon_specific_type) return (TRUE);
- if (!summon_unique_okay && ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))) return FALSE;
-
if ((summon_specific_who < 0) &&
((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL)) &&
monster_has_hostile_align(NULL, 10, -10, r_ptr))
summon_specific_type = 0;
/* Success */
+ sound(SOUND_SUMMON);
return (TRUE);
}
if (!(r_ptr->flags2 & (RF2_SMART)) && (randint0(100) < 50)) return;
- /* XXX XXX XXX */
/* Analyze the knowledge */
switch (what)
*/
void monster_drop_carried_objects(monster_type *m_ptr)
{
- s16b this_o_idx, next_o_idx = 0;
+ OBJECT_IDX this_o_idx, next_o_idx = 0;
object_type forge;
object_type *o_ptr;
object_type *q_ptr;
/* Drop objects being carried */
for (this_o_idx = m_ptr->hold_o_idx; this_o_idx; this_o_idx = next_o_idx)
{
- /* Acquire object */
o_ptr = &o_list[this_o_idx];
/* Acquire next object */
/* Forget monster */
q_ptr->held_m_idx = 0;
- /* Delete the object */
delete_object_idx(this_o_idx);
/* Drop it */